(function(){if(window.BX.CViewer)return;BX.viewElementBind=function(e,t,r,s){var o=new BX.CViewer(t);if(!r){r=function(e){return BX.type.isElementNode(e)&&(e.getAttribute("data-bx-viewer")||e.tagName.toUpperCase()=="IMG")}}BX.ready(function(){i(e,r,s,o)});return o};var e=0;var t=null;function i(i,r,s,o){var i=BX(i);if(!!i){if(BX.getClass("BX.UI.Viewer")&&BX(i)){BX.findChildren(i,r,true).forEach(function(e){if(e.dataset.bxSrc){e.dataset.src=e.dataset.bxSrc}if(e.dataset.bxImage){e.dataset.src=e.dataset.bxImage}if(e.dataset.bxViewer==="image"){e.dataset.viewerType="image"}});BX.UI.Viewer.bind(BX(i),r);return}BX.bindDelegate(i,"click",r,function(a){if(BX.findParent(this,{tagName:"a",attribute:{target:"_blank"}},5)){return true}if(this.getAttribute("data-bx-viewer")=="folder")return true;e++;if(e!==1){clearTimeout(t);e=0;return true}else{t=setTimeout(function(){e=0},1e3)}var n=i;if(!!s){n=BX.findParent(this,s,i)||n}o.setList([]);var l=BX.findChildren(n,r,true);for(var d=0;d<l.length;d++){var c=l[d].getAttribute("data-bx-viewer");if(c=="image"||l[d].getAttribute("data-bx-image")){var h=new BX.CViewImageElement({src:l[d].getAttribute("data-bx-src")||l[d].getAttribute("data-bx-download")||l[d].getAttribute("data-bx-image"),width:l[d].getAttribute("data-bx-width"),height:l[d].getAttribute("data-bx-height"),title:l[d].getAttribute("data-bx-title")||l[d].alt||l[d].title,full:l[d].getAttribute("data-bx-full"),full_width:l[d].getAttribute("data-bx-full-width"),full_height:l[d].getAttribute("data-bx-full-height"),full_size:l[d].getAttribute("data-bx-full-size"),buttons:[]});h.buttons.push(h.getComplexSaveButton(o,{downloadUrl:l[d].getAttribute("data-bx-download")||l[d].getAttribute("data-bx-full")||l[d].getAttribute("data-bx-image")||l[d].getAttribute("data-bx-src")}));o.add(h)}else if(c=="iframe-extlinks"){var p=new BX.CViewIframeExtLinksElement({title:l[d].getAttribute("data-bx-title"),src:l[d].getAttribute("data-bx-src"),viewerUrl:l[d].getAttribute("data-bx-viewerUrl"),buttons:[]});p.buttons.push(BX.create("a",{props:{className:"bx-viewer-btn",href:l[d].getAttribute("data-bx-src")},events:{click:BX.delegate(function(e){if(!this.loaded){var t=this;setTimeout(function(){o.show(t)},50)}BX.eventCancelBubble(e);return false},p)},text:BX.message("JS_CORE_VIEWER_DOWNLOAD")}));o.add(p)}else if(c=="iframe"){var p=o.createElementByType(l[d]);o.add(p)}else if(c=="ajax"){var u=o.createElementByType(l[d]);o.add(u)}else if(c=="unknown"){var m=new BX.CViewUnknownElement({title:l[d].getAttribute("data-bx-title"),src:l[d].getAttribute("data-bx-src"),isFromUserLib:!!l[d].getAttribute("data-bx-isFromUserLib"),externalId:l[d].getAttribute("data-bx-externalId"),objectId:l[d].getAttribute("bx-attach-file-id"),relativePath:l[d].getAttribute("data-bx-relativePath"),editUrl:l[d].getAttribute("data-bx-edit"),fakeEditUrl:l[d].getAttribute("data-bx-fakeEdit"),owner:l[d].getAttribute("data-bx-owner"),size:l[d].getAttribute("data-bx-size"),dateModify:l[d].getAttribute("data-bx-dateModify"),tooBigSizeMsg:!!l[d].getAttribute("data-bx-tooBigSizeMsg"),buttons:[]});m.buttons.push(m.getLocalEditButton(o,{enableEdit:!!m.isFromUserLib||!!m.editUrl}));m.buttons.push(m.getComplexSaveButton(o,{downloadUrl:l[d].getAttribute("data-bx-src")}));o.add(m)}else if(c=="onlyedit"){var f=o.createElementByType(l[d]);o.add(f)}else if(c=="folder"){o.add(new BX.CViewFolderElement({title:l[d].getAttribute("data-bx-title"),src:l[d].getAttribute("data-bx-src"),owner:l[d].getAttribute("data-bx-owner"),dateModify:l[d].getAttribute("data-bx-dateModify"),buttons:[]}))}}BX.CViewer.objNowInShow=o;o.show(this.getAttribute("data-bx-image")||this.getAttribute("data-bx-src")||this.src);return BX.PreventDefault(a)});BX.bindDelegate(i,"dblclick",r,function(e){BX.PreventDefault(e)})}}BX.CViewCoreElement=function(e){e=e||{};this.baseElementId=e.baseElementId;this.id=e.id||e.src;this.title=e.title;this.text=e.text;this.width=e.width;this._minWidth=e._minWidth;this.height=e.height;this._minHeight=e._minHeight;this.domElement=null;this.titleDomElement=null;this.titleButtons=null;this.src=e.src;this.loaded=false;this.preventShow=false;this.listOfTimeoutIds=[];this.contentWrap=null;this.isProccessed=false;this.topPadding=0;this.buttons=e.buttons||[];this.showTitle=e.showTitle||true;this.isHistory=false;this.autoReduction=false;if(this._minWidth===undefined){this._minWidth=550}if(this._minHeight===undefined){this._minHeight=350}this.isFromUserLib=e.isFromUserLib||false;this.externalId=e.externalId||false;this.objectId=e.objectId||false;this.relativePath=e.relativePath||false;this.editUrl=e.editUrl||false;this.fakeEditUrl=e.fakeEditUrl||false};BX.CViewCoreElement.prototype.getDataForCommit=function(){return{}};BX.CViewCoreElement.prototype.setContentWrap=function(e){this.contentWrap=e};BX.CViewCoreElement.prototype.runAction=function(e,t){e=e.toLowerCase();switch(e){case"edit":if(!this.editUrl){return false}this.addTimeoutId(setTimeout(function(){BX.fireEvent(BX("bx-viewer-edit-btn"),"click")},100));break;case"localedit":case"forceedit":if(!t.obElementViewer){return false}if(BX.CViewer.enableInVersionDisk(2)&&!this.hasOwnProperty("image")){if(!BX.message("disk_document_service")){t.obElementViewer.openWindowForSelectDocumentService({viewInUf:!!BX.message.disk_render_uf});return}}this.localEditProcess(t.obElementViewer,t);break;case"localview":if(!t.obElementViewer){return false}this.localViewProcess(t.obElementViewer);break}return};BX.CViewCoreElement.prototype.localEditProcess=function(e,t){t=t||{};var i=this.editUrl;if(BX.CViewer.isEnableLocalEditInDesktop()){if(!this.isFromUserLib&&i){if(i.indexOf("/")===0){window.location.origin=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");i=window.location.origin+i}i=r.getUrlEditFile(i,"l");if(!!t.isCreate){BX.CViewer.goToBx("bx://createFile/url/"+encodeURIComponent(i)+"/name/"+encodeURIComponent(this.title))}else{i=BX.util.remove_url_param(i,"filename");BX.CViewer.goToBx("bx://editFile"+"/externalId/"+(this.externalId?encodeURIComponent(this.externalId):"0")+"/objectId/"+(this.objectId?encodeURIComponent(this.objectId):"0")+"/url/"+encodeURIComponent(i)+"/name/"+encodeURIComponent(this.title))}}else if(this.relativePath&&this.externalId){BX.CViewer.goToBx("bx://openFile/externalId/"+encodeURIComponent(this.externalId))}e.close();return}return};BX.CViewCoreElement.prototype.localViewProcess=function(e){var t=this.downloadUrl;if(BX.CViewer.isEnableLocalEditInDesktop()){if(!this.isFromUserLib&&t){if(t.indexOf("/")===0){window.location.origin=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");t=window.location.origin+t}t=r.getUrlEditFile(t,"l");t=BX.util.remove_url_param(t,"filename");BX.CViewer.goToBx("bx://viewFile"+"/externalId/"+(this.externalId?encodeURIComponent(this.externalId):"0")+"/objectId/"+(this.objectId?encodeURIComponent(this.objectId):"0")+"/url/"+encodeURIComponent(t)+"/name/"+encodeURIComponent(this.title))}else if(this.relativePath&&this.externalId){BX.CViewer.goToBx("bx://openFile/externalId/"+encodeURIComponent(this.externalId))}e.close();return}return};BX.CViewCoreElement.prototype.getTextForSave=function(){return""};BX.CViewCoreElement.prototype.getComplexEditButton=function(e,t,i){i=i||false;var r={editBtn:"bx-viewer-btn-split-text"};if(i){r={editBtn:"webform-small-button",serviceText:"bx-viewer-edit-service-txt"}}var s={click:BX.delegate(function(t){if(!a||!this.getCurrent().editUrl){return BX.PreventDefault(t)}var i=t.srcElement||t.target;var r=[{text:BX.message("JS_CORE_VIEWER_EDIT_IN_SERVICE").replace("#SERVICE#",this.getNameEditService("google")),className:"bx-viewer-popup-item item-gdocs",href:"#",onclick:BX.delegate(function(e){this.setEditService("google");BX.fireEvent(BX("bx-viewer-edit-btn"),"click");this.closeMenu();return BX.PreventDefault(e)},this)},BX.CViewer.enableInVersionDisk(6)?{text:BX.message("JS_CORE_VIEWER_EDIT_IN_SERVICE").replace("#SERVICE#",this.getNameEditService("office365")),className:"bx-viewer-popup-item item-office365",href:"#",onclick:BX.delegate(function(e){this.setEditService("office365");BX.fireEvent(BX("bx-viewer-edit-btn"),"click");this.closeMenu();return BX.PreventDefault(e)},this)}:null,BX.message("DISK_MYOFFICE")?{text:BX.message("JS_CORE_VIEWER_EDIT_IN_SERVICE").replace("#SERVICE#",this.getNameEditService("myoffice")),className:"bx-viewer-popup-item item-myoffice",href:"#",onclick:BX.delegate(function(e){this.setEditService("myoffice");BX.fireEvent(BX("bx-viewer-edit-btn"),"click");this.closeMenu();return BX.PreventDefault(e)},this)}:null,{text:BX.message("JS_CORE_VIEWER_EDIT_IN_SERVICE").replace("#SERVICE#",this.getNameEditService("skydrive")),className:"bx-viewer-popup-item item-office",href:"#",onclick:BX.delegate(function(e){this.setEditService("skydrive");BX.fireEvent(BX("bx-viewer-edit-btn"),"click");this.closeMenu();return BX.PreventDefault(e)},this)}];if(this.getCurrent().editUrl&&!BX.CViewer.isDisabledLocalEdit){r.push({text:BX.message("JS_CORE_VIEWER_EDIT_IN_LOCAL_SERVICE").replace("#SERVICE#",this.getNameEditService("local")),className:"bx-viewer-popup-item item-local",href:"#",onclick:BX.delegate(function(t){if(BX.CViewer.isEnableLocalEditInDesktop()){this.setEditService("local");BX.fireEvent(BX("bx-viewer-edit-btn"),"click")}else{e.helpDiskDialog()}this.closeMenu();return BX.PreventDefault(t)},this)})}this.openMenu("bx-viewer-popup-edit",BX(i),r,{offsetTop:0,offsetLeft:-9,zIndex:11400})},e)};var o="";var a=t.enableEdit||false;if(t.isLocked){a=false;o=BX.message("JS_CORE_VIEWER_DOCUMENT_IS_LOCKED_BY")}if(!t.enableEdit){o=BX.message("JS_CORE_VIEWER_DISABLE_EDIT_BY_PERM")}var n=e.initEditService();var l=BX.create("span",{props:{id:"bx-viewer-edit-btn",className:r.editBtn},events:{click:BX.delegate(function(t){if(!a||!this.editUrl){return BX.PreventDefault(t)}BX.PreventDefault(t);e.runActionByCurrentElement("forceEdit",{obElementViewer:e})},this)},children:[BX.create("i",{props:{id:"bx-viewer-edit-service-txt",className:r.serviceText||null},text:!BX.CViewer.isLocalEditService(n)?e.getNameEditService(n):e.getNameEditService()})]});l.insertBefore(document.createTextNode(BX.message(BX.CViewer.isLocalEditService(n)?"JS_CORE_VIEWER_EDIT_IN_LOCAL_SERVICE_SHORT":"JS_CORE_VIEWER_EDIT_IN_SERVICE").replace("#SERVICE#"," ")),l.firstChild);if(i){return BX.create("span",{props:{className:"bx-viewer-btn-split bx-viewer-btn-split-margin-top "+(a?"":"bx-viewer-btn-split-disable"),title:o},children:[BX.create("span",{props:{className:"webform-small-button-separate-wrap"},children:[l,BX.create("span",{props:{className:"webform-small-button-right-part"},events:s})]})]})}else{return BX.create("span",{props:{className:"bx-viewer-btn-split "+(a?"":"bx-viewer-btn-split-disable"),title:o},children:[BX.create("span",{props:{className:"bx-viewer-btn-split-l"},children:[l,BX.create("span",{props:{className:"bx-viewer-btn-split-bg"}})]}),BX.create("span",{props:{className:"bx-viewer-btn-split-r"},events:s,children:[BX.create("span",{props:{className:"bx-viewer-btn-split-bg"}})]})]})}};BX.CViewCoreElement.prototype.getLocalEditButton=function(e,t){var i=t.enableEdit||false;if(!this.editUrl||!BX.CViewer.isEnableLocalEditInDesktop()){return[]}var r=BX.create("span",{props:{id:"bx-viewer-edit-btn",className:"bx-viewer-btn-split-text"},events:{click:BX.delegate(function(t){if(!i){return BX.PreventDefault(t)}BX.PreventDefault(t);e.runActionByCurrentElement("localEdit",{obElementViewer:e})},this)},children:[BX.create("span",{props:{id:"bx-viewer-edit-service-txt"},text:e.getNameEditService("local")})]});r.insertBefore(document.createTextNode(BX.message("JS_CORE_VIEWER_EDIT_IN_LOCAL_SERVICE_SHORT").replace("#SERVICE#"," ")),r.firstChild);return BX.create("span",{props:{className:"bx-viewer-btn-split "+(i?"":"bx-viewer-btn-split-disable"),title:i?"":BX.message("JS_CORE_VIEWER_DISABLE_EDIT_BY_PERM")},children:[BX.create("span",{props:{className:"bx-viewer-btn-split-l"},children:[r,BX.create("span",{props:{className:"bx-viewer-btn-split-bg"}})]})]})};BX.CViewCoreElement.prototype.getComplexSaveButton=function(e,t){var i=t.downloadUrl;t.reloadAfterDownload=t.reloadAfterDownload||false;return BX.create("a",{props:{className:"bx-viewer-btn bx-viewer-btn-save",href:i},events:{click:BX.delegate(function(s){var o=s.srcElement||s.target;e.openMenu("bx-viewer-popup-down",BX(o),[BX.CViewer.isDisabledLocalEdit||!BX.message.disk_revision_api?null:{text:BX.message("JS_CORE_VIEWER_SAVE_TO_OWN_FILES"),className:"bx-viewer-popup-item item-b24",href:"#",onclick:BX.delegate(function(s){var o=this.addToLinkParam(BX.CViewer.enableInVersionDisk(2)?i:this.src,"saveToDisk",1);o=this.addToLinkParam(o,"toWDController",1);o=BX.util.remove_url_param(o,"showInViewer");o=BX.util.remove_url_param(o,"document_action");o=BX.util.remove_url_param(o,"primaryAction");o=r.getUrlCopyToMe(o);e.closeMenu();BX.CViewer.getWindowCopyToDisk({link:o,selfViewer:e,title:this.title,showEdit:t.showEdit});BX.PreventDefault(s);return false},this)},{text:BX.message("JS_CORE_VIEWER_DOWNLOAD_TO_PC"),className:"bx-viewer-popup-item item-download",href:i,onclick:BX.delegate(function(i){e.closeMenu();if(t.reloadAfterDownload&&!this.loaded){setTimeout(BX.delegate(function(){e.show(this,true)},1e3),this)}BX.eventCancelBubble(i);return false},this)}],{offsetTop:0,offsetLeft:-9});return BX.PreventDefault(s)},this)},text:BX.message("JS_CORE_VIEWER_SAVE")})};BX.CViewCoreElement.prototype.getExtension=function(e){e=e||"";return e.split(".").pop()};BX.CViewCoreElement.prototype.getIconClassByName=function(e){var t=this.getExtension(e);var i="";switch(t.toLowerCase()){case"txt":i="bx-viewer-icon-txt";break;case"archive":case"gz":case"bz2":case"tar":i="bx-viewer-icon-archive";break;case"zip":i="bx-viewer-icon-zip";break;case"rar":i="bx-viewer-icon-rar";break;case"pdf":i="bx-viewer-icon-pdf";break;case"ppt":case"pptx":i="bx-viewer-icon-ppt";break;case"doc":case"docx":i="bx-viewer-icon-doc";break;case"xls":case"xlsx":i="bx-viewer-icon-xls";break;case"avi":case"wmv":case"mp4":case"mov":case"webm":case"flv":case"m4v":case"mkv":case"vob":case"3gp":case"ogv":i="bx-viewer-icon-video";break;default:i="bx-viewer-icon";break}return i};BX.CViewCoreElement.prototype.load=function(e,t){};BX.CViewCoreElement.prototype.preload=function(e){};BX.CViewCoreElement.prototype.hide=function(e){e=e||false;this.preventTimeout();this.preventShow=true};BX.CViewCoreElement.prototype.show=function(){this.preventShow=false};BX.CViewCoreElement.prototype.successLoad=function(e){};BX.CViewCoreElement.prototype.onLoad=function(){};BX.CViewCoreElement.prototype.getTitle=function(){return this.title};BX.CViewCoreElement.prototype.getSize=function(){return{width:this.width,height:this.height}};BX.CViewCoreElement.prototype.resize=function(e,t){this.width=e;this.height=t};BX.CViewCoreElement.prototype.addTimeoutId=function(e){this.listOfTimeoutIds.push(e)};BX.CViewCoreElement.prototype.preventTimeout=function(){if(!BX.type.isArray(this.listOfTimeoutIds)){return}for(var e in this.listOfTimeoutIds){if(this.listOfTimeoutIds.hasOwnProperty(e)){clearTimeout(this.listOfTimeoutIds[e])}}this.listOfTimeoutIds=[]};BX.CViewCoreElement.prototype.addToLinkSessid=function(e){return this.addToLinkParam(e,"sessid",BX.bitrix_sessid())};BX.CViewCoreElement.prototype.addToLinkParam=function(e,t,i){if(!e.length){return"?"+t+"="+i}e=BX.util.remove_url_param(e,t);if(e.indexOf("?")!=-1){return e+"&"+t+"="+i}return e+"?"+t+"="+i};BX.CViewCoreElement.prototype.getBottomHtml=function(){return""};BX.CViewImageElement=function(e){e=e||{};BX.CViewIframeElement.superclass.constructor.apply(this,arguments);this.image=null;this.width=e.width||200;this.height=e.height||200;this.full=e.full;this.full_width=e.full_width;this.full_height=e.full_height;this.full_size=e.full_size;this.topPadding=43;this.imageElement=true};BX.extend(BX.CViewImageElement,BX.CViewCoreElement);BX.CViewImageElement.prototype.setContentWrap=function(e){this.contentWrap=e};BX.CViewImageElement.prototype.load=function(e){e=e||BX.CViewImageElement.prototype.successLoad;if(!this.loaded){this.preload(function(t){e(t);t.contentWrap.appendChild(t.domElement)})}else{(function(t){e(t);t.contentWrap.appendChild(t.domElement)})(this)}};BX.CViewImageElement.prototype.preload=function(e){if(this.isProccessed){return false}this.successLoad=e||BX.CViewImageElement.prototype.successLoad;if(!this.loaded){this.titleDomElement=BX.create("span",{props:{className:"bx-viewer-file-name-block bx-viewer-file-center",title:this.title},children:[BX.create("span",{props:{className:"bx-viewer-file-name",title:this.title},text:this.title}),BX.create("span",{props:{className:"bx-viewer-file-last-v",title:this.title}})]});this.titleButtons=BX.create("span",{props:{className:"bx-viewer-top-right"},style:{display:"none"},children:this.buttons});this.image=new Image;this.image.onload=BX.proxy(this.onLoad,this);this.image.src=this.src;this.image.className="bx-viewer-image";this.image.style.opacity=0;this.isProccessed=true;this.domElement=BX.create("div",{props:{className:"bx-viewer-cap-wrap"},children:[]})}return this.domElement};BX.CViewImageElement.prototype.hide=function(e){e=e||false;this.image.style.opacity=0;this.titleButtons.style.display="none";this.preventTimeout();this.preventShow=e?false:true};BX.CViewImageElement.prototype.show=function(){if(!this.domElement){return}var e=this.height;if(this.image&&this.image.style.height){e=parseInt(this.image.style.height)}if(e<this._minHeight){BX.adjust(this.domElement,{style:{paddingTop:(this._minHeight-e)/2+"px"}})}this.titleButtons.style.display="block";this.image.style.opacity=1;this.preventShow=false};BX.CViewImageElement.prototype.successLoad=function(e){};BX.CViewImageElement.prototype.onLoad=function(){this.isProccessed=false;setTimeout(BX.delegate(function(){this.loaded=true;this.height=this.image.height;this.width=this.image.width;this.image.style.maxWidth=this.width+"px";this.image.style.maxHeight=this.height+"px";this.domElement.appendChild(this.image);this.successLoad(this)},this),150)};BX.CViewImageElement.prototype.getBottomHtml=function(){if(!this.full){return""}var e=[];if(this.full_height&&this.full_width){e.push(this.full_width+"x"+this.full_height)}if(this.full_size){e.push(this.full_size)}var t='<a href="'+this.full+'" class="bx-viewer-full-link" target="_blank">'+BX.message("JS_CORE_IMAGE_FULL")+(e.length>0?" ("+e.join(", ")+")":"")+"</a>";return t};BX.CViewEditableElement=function(e){BX.CViewEditableElement.superclass.constructor.apply(this,arguments);this.askConvert=!!e.askConvert;this.editUrl=e.editUrl?this.addToLinkSessid(e.editUrl):"";this.lockedBy=e.lockedBy;this.fakeEditUrl=e.fakeEditUrl||false;this.historyPageUrl=e.historyPageUrl||"";this.downloadUrl=e.downloadUrl||"";this.dataForCommit={};this.urlToPost=e.urlToPost||"";this.idToPost=e.idToPost||"";this.isNowConverted=false;this.version=parseInt(e.version)||0;this.hideEdit=e.hideEdit==1;this.dateModify=e.dateModify;this.currentModalWindow=e.currentModalWindow||false;this.editInProcess=false};BX.extend(BX.CViewEditableElement,BX.CViewCoreElement);BX.CViewEditableElement.prototype.runAction=function(e,t){this.editInProcess=false;e=e.toLowerCase();switch(e){case"discard":this.discardFile(t);break;case"edit":if(!this.editUrl){return false}this.addTimeoutId(setTimeout(function(){BX.fireEvent(BX("bx-viewer-edit-btn"),"click")},100));break;case"forceedit":if(!!BX.message("disk_document_service")&&BX.CViewer.isLocalEditService(BX.message("disk_document_service"))&&BX.CViewer.isEnableLocalEditInDesktop()){this.localEditProcess(t.obElementViewer);return}if(!this.editUrl||!t.obElementViewer){return false}if(BX.CViewer.enableInVersionDisk(2)&&!this.hasOwnProperty("imageElement")){if(!BX.message("disk_document_service")){return}}this.editFile(t.obElementViewer);break;case"localedit":this.localEditProcess(t.obElementViewer,t);break;case"localview":if(!t.obElementViewer){return false}this.localViewProcess(t.obElementViewer);break;case"commit":this.commitFile(t);break;case"create":if(!t.obElementViewer){return false}if(BX.CViewer.enableInVersionDisk(2)&&!this.hasOwnProperty("image")){if(!BX.message("disk_document_service")){t.obElementViewer.openWindowForSelectDocumentService({viewInUf:!!BX.message.disk_render_uf});return}}this.createFile(t.obElementViewer);break;case"saveas":case"save":if(!t.obElementViewer){return false}this.saveFile(t);break;case"pasteinform":this.pasteInForm(t);break;case"rename":this.renameFile(t);break;case"submit":this.submitAction(t);break}return};BX.CViewEditableElement.prototype.createFile=function(e){return};BX.CViewEditableElement.prototype.submitAction=function(e){return};BX.CViewEditableElement.prototype.renameFile=function(e){return};BX.CViewEditableElement.prototype.pasteInForm=function(e){return};BX.CViewEditableElement.prototype.discardFile=function(e){var t=e.uriToDoc||r.getUrlDiscardFile(this.editUrl);var i=e.idDoc||e.id;if(!t||!i){return false}BX.ajax({method:"POST",dataType:"json",url:t,data:{discard:1,editSessionId:e.editSessionId,id:i,sessid:BX.bitrix_sessid()},onsuccess:function(){}})};BX.CViewEditableElement.prototype.getTextForSave=function(){return BX.message("JS_CORE_VIEWER_IFRAME_PROCESS_SAVE_DOC")};BX.CViewEditableElement.prototype.isConverted=function(){if(this.isNowConverted){return true}return!!BX.CViewer._convertElementsMatch[this.src]};BX.CViewEditableElement.prototype.getExtensionAfterConvert=function(){var e=this.getExtension(this.title);var t="";switch(e.toLowerCase()){case"ppt":case"pptx":t="pptx";break;case"doc":case"docx":t="docx";break;case"xls":case"xlsx":t="xlsx";break}return t};BX.CViewEditableElement.prototype.editFile=function(e){this.editInProcess=true;if(!BX.CViewer.isLocalEditService(e.initEditService())&&this.askConvert){var t=BX.create("div",{props:{className:"bx-viewer-confirm"},children:[BX.create("div",{props:{className:"bx-viewer-confirm-title"},text:BX.message("JS_CORE_VIEWER_CONVERT_TITLE").replace("#NEW_FORMAT#",this.getExtensionAfterConvert()),children:[]}),BX.create("div",{props:{className:"bx-viewer-confirm-text-wrap"},children:[BX.create("span",{props:{className:"bx-viewer-confirm-text-alignment"}}),BX.create("span",{props:{className:"bx-viewer-confirm-text"},text:BX.message("JS_CORE_VIEWER_IFRAME_CONVERT_TO_NEW_FORMAT_EX").replace("#NEW_FORMAT#",this.getExtensionAfterConvert()).replace("#OLD_FORMAT#",this.getExtension(this.title))})]})]});e.openConfirm(t,[new BX.PopupWindowButton({text:BX.message("JS_CORE_VIEWER_IFRAME_CONVERT_ACCEPT"),className:"popup-window-button-accept",events:{click:BX.delegate(function(){this.editFileProcess(e)},this)}}),new BX.PopupWindowButton({text:BX.message("JS_CORE_VIEWER_IFRAME_CONVERT_DECLINE"),events:{click:BX.delegate(function(){this.closeConfirm();this.editInProcess=false},e)}})],true)}else{this.editFileProcess(e)}};BX.CViewEditableElement.prototype.getCurrentModalWindow=function(){return this.currentModalWindow};BX.CViewEditableElement.prototype.setCurrentModalWindow=function(e){this.currentModalWindow=e};BX.CViewEditableElement.prototype.openEditConfirm=function(e){var t=BX.create("div",{props:{className:"bx-viewer-confirm"},children:[BX.create("div",{props:{className:"bx-viewer-confirm-title"},text:BX.message("JS_CORE_VIEWER_NOW_EDITING_IN_SERVICE").replace("#SERVICE#",e.getNameEditService()),children:[]}),BX.create("div",{props:{className:"bx-viewer-confirm-text-wrap"},children:[BX.create("span",{props:{className:"bx-viewer-confirm-text-alignment"}}),BX.create("span",{props:{className:"bx-viewer-confirm-text"},text:BX.message("JS_CORE_VIEWER_IFRAME_DESCR_SAVE_DOC_F").replace("#SAVE_DOC#",BX.message("JS_CORE_VIEWER_IFRAME_SAVE_DOC"))})]})]});e.openConfirm(t,[new BX.PopupWindowButton({text:BX.message("JS_CORE_VIEWER_IFRAME_SAVE_DOC"),className:"popup-window-button-accept",events:{click:BX.delegate(function(){window.onbeforeunload=null;this.showLoading({text:this.getCurrent().getTextForSave()});var e=this.getCurrent().getDataForCommit();e.obElementViewer=this;e.success=BX.delegate(function(e,t){if(this.bVisible&&this.isCurrent(e)){if(e.getLastVersionUri){BX.ajax({method:"POST",dataType:"json",url:e.getLastVersionUri,data:{sessid:BX.bitrix_sessid()},onsuccess:BX.delegate(function(t){if(t.version){e.version=t.version}if(t.editUrl){e.editUrl=t.editUrl}if(t.src){e.src=t.src}if(e.iframeSrc){if(t.iframeSrc){e.iframeSrc=t.iframeSrc}var i=this.createIframeElementFromAjaxElement(e);i.setCurrentModalWindow(e.getCurrentModalWindow());this.getCurrent().hide();this.setCurrent(i);this.show()}else{this.show(e,true)}},this)})}else{if(e.iframeSrc){var i=this.createIframeElementFromAjaxElement(e);i.setCurrentModalWindow(e.getCurrentModalWindow());this.getCurrent().hide();this.setCurrent(i);this.show()}else{this.show(e,true)}}}},this);this.runActionByCurrentElement("commit",e);this.closeConfirm();try{this.getCurrent().getCurrentModalWindow().close()}catch(e){}},e)}}),new BX.PopupWindowButton({text:BX.message("JS_CORE_VIEWER_IFRAME_CANCEL"),events:{click:BX.delegate(function(){window.onbeforeunload=null;this.runActionByCurrentElement("discard",this.getCurrent().getDataForCommit());this.closeConfirm();try{this.getCurrent().getCurrentModalWindow().close()}catch(e){}},e)}})],true)};BX.CViewEditableElement.prototype.editFileProcess=function(e){var t=this.editUrl;if(BX.CViewer.temporaryServiceEditDoc){t=this.addToLinkParam(this.editUrl,"editIn",BX.CViewer.temporaryServiceEditDoc);if(BX.CViewer.isLocalEditService(BX.CViewer.temporaryServiceEditDoc)){this.localEditProcess(e,{});BX.CViewer.temporaryServiceEditDoc="";return false}t=r.getUrlEditFile(t,BX.CViewer.temporaryServiceEditDoc);BX.CViewer.temporaryServiceEditDoc=""}else if(BX.CViewer.isLocalEditService(e.initEditService())){this.localEditProcess(e,{});return false}else if(!this.isFromUserLib&&BX.CViewer.isLocalEditService(e.initEditService())){e.setEditService("g");t=this.addToLinkParam(this.editUrl,"editIn","g")}this.setCurrentModalWindow(e.openModal(t,this.title));window.onbeforeunload=BX.delegate(this.onUnload,this);this.openEditConfirm(e);return false};BX.CViewEditableElement.prototype.onUnload=function(){try{this.runAction("discard",this.getDataForCommit())}catch(e){}};BX.CViewEditableElement.prototype.setDataForCommit=function(e){if(e&&arguments.length==1){this.dataForCommit=e}else if(BX.browser.IsIE()||BX.browser.IsIE11()||/Edge\/./i.test(navigator.userAgent)){for(var t in arguments){if(!arguments.hasOwnProperty(t)){continue}switch(t){case 0:case"0":this.dataForCommit["iframeSrc"]=arguments[t];break;case 1:case"1":this.dataForCommit["uriToDoc"]=arguments[t];break;case 3:case"3":this.dataForCommit["editSessionId"]=arguments[t];break;case 4:case"4":this.dataForCommit["id"]=arguments[t];break;case 5:case"5":this.dataForCommit["link"]=arguments[t];break}}}return};BX.CViewEditableElement.prototype.getDataForCommit=function(){return this.dataForCommit};BX.CViewEditableElement.prototype.commitFile=function(e){window.onbeforeunload=null;e=e||{};if(!e||!e.obElementViewer){return false}var t=e.uriToDoc||r.getUrlCommitFile(this.editUrl);var i=e.idDoc||e.id;if(!t||!i){return false}BX.ajax({method:"POST",dataType:"json",url:t,data:{commit:1,editSessionId:e.editSessionId,id:i,sessid:BX.bitrix_sessid()},onsuccess:BX.delegate(function(t){if(t.originalIsLocked){BX.CViewer.objNowInShow.close();BX.Disk.InformationPopups.showWarningLockedDocument({link:BX.Disk.getUrlToShowObjectInGrid(t.forkedObject.id)});return}var i=t.newName;var r=t.oldName;if(i){BX.CViewer._convertElementsMatch[this.src]={src:this.src.replace(r,i),editUrl:this.editUrl.replace(r,i),title:this.title.replace(r,i)};this.title=BX.CViewer._convertElementsMatch[this.src].title;this.editUrl=BX.CViewer._convertElementsMatch[this.src].editUrl;this.src=BX.CViewer._convertElementsMatch[this.src].src;this.isNowConverted=true}if(this.title.split(".").pop()=="xodt"&&BX.message.disk_document_service==="myoffice"){this.dateModify=BX.date.format(BX.date.convertBitrixFormat(BX.message("FORMAT_DATETIME")),new Date,null)}if(BX.type.isFunction(e.success)){e.success(this,t)}BX.onCustomEvent(this,"onIframeElementConverted",[this,i,r])},this)});return false};BX.CViewBlankElement=function(e){BX.CViewBlankElement.superclass.constructor.apply(this,arguments);this.id="blank_file";this.editUrl=e.editUrl;this.fakeEditUrl=e.fakeEditUrl||false;this.renameUrl=e.renameUrl;this.docType=e.docType;this.elementId=false;this.sectionId=false;this.objectId=false;this.targetFolderId=e.targetFolderId||false;this.idDoc="";this.uriToDoc="";this.oldName="";this.newName="";this.docService="g";this.afterSuccessCreate=function(){}};BX.extend(BX.CViewBlankElement,BX.CViewEditableElement);BX.CViewBlankElement.prototype.discardFile=function(e){var t=e.editUrl;if(this.editUrl){t=r.getUrlDiscardBlankFile(this.editUrl)}else{t=e.uriToDoc;if(!t){return false}t=this.addToLinkParam(t,"createDoc",1);t=this.addToLinkParam(t,"discard",1)}var i=e.idDoc||e.id;if(!t||!i){return false}BX.ajax({method:"POST",dataType:"json",url:t,data:{discard:1,editSessionId:e.editSessionId,id:i,sessid:BX.bitrix_sessid()},onsuccess:function(){}})};BX.CViewBlankElement.prototype.submitAction=function(e){if(BX("wd-btn-save-blank-with-new-name")){BX.fireEvent(BX("wd-btn-save-blank-with-new-name"),"click")}return};BX.CViewBlankElement.prototype.createFile=function(e){var t;this.docService=e.initEditService();if(this.editUrl){t=r.getUrlStartPublishBlank(this.editUrl,this.docService,this.docType);if(BX.CViewer.isLocalEditService(this.docService)){BX.ajax({method:"POST",dataType:"json",url:t,data:{targetFolderId:this.targetFolderId||"",sessid:BX.bitrix_sessid()},onsuccess:BX.delegate(function(t){if(!t){return}try{var i={status:"success",objectId:t.object.id,name:t.object.name,folderName:t.folderName,size:t.object.size,sizeInt:t.object.sizeInt,extension:t.object.extension,ext:t.object.extension,link:t.link}}catch(e){}this.title=t.object.name;this.editUrl=t.link;e.runActionByCurrentElement("localedit",{obElementViewer:e,isCreate:true});this.afterSuccessCreate(i)},this)});return}}else{t=this.addToLinkParam("/company/personal/user/"+BX.message("USER_ID")+"/files/lib/","createIn",e.initEditService());t=this.addToLinkParam(t,"toWDController",1);t=this.addToLinkParam(t,"type",this.docType);t=this.addToLinkParam(t,"createDoc","1");t=this.addToLinkSessid(t)}var i=e.openModal(t,this.title);var s=BX.create("div",{props:{className:"bx-viewer-confirm"},children:[BX.create("div",{props:{className:"bx-viewer-confirm-title"},text:BX.message("JS_CORE_VIEWER_NOW_CREATING_IN_SERVICE").replace("#SERVICE#",e.getNameEditService()),children:[]}),BX.create("div",{props:{className:"bx-viewer-confirm-text-wrap"},children:[BX.create("span",{props:{className:"bx-viewer-confirm-text-alignment"}}),BX.create("span",{props:{className:"bx-viewer-confirm-text"},text:BX.message("JS_CORE_VIEWER_CREATE_DESCR_SAVE_DOC_F").replace("#SAVE_AS_DOC#",BX.message("JS_CORE_VIEWER_SAVE_AS"))})]})]});BX.CViewer.lockScroll();e.openConfirm(s,[new BX.PopupWindowButton({text:BX.message("JS_CORE_VIEWER_SAVE_AS"),className:"popup-window-button-accept",events:{click:BX.delegate(function(){BX.CViewer.showLoading(BX.findChild(s,{className:"bx-viewer-confirm-text-wrap"},true),{className:"bx-viewer-wrap-loading-modal",notAddClassLoadingToObj:true});if(BX.proxy_context&&BX.is_subclass_of(BX.proxy_context,BX.PopupWindowButton)){BX.proxy_context.setClassName("webform-button-accept webform-button-disable")}var e=BX.findChild(s,{className:"bx-viewer-confirm-title"},true);if(e){BX.adjust(e,{text:BX.message("JS_CORE_VIEWER_NOW_DOWNLOAD_FROM_SERVICE").replace("#SERVICE#",this.getNameEditService())})}var t=this.getCurrent().getDataForCommit();if(BX.CViewer.isEmptyObject(t)){this.closeConfirm();BX.CViewer.unlockScroll()}else{this.getCurrent().idDoc=t.idDoc||t.id;t.obElementViewer=this;t.success=BX.delegate(function(e,t){this.closeConfirm()},this);this.runActionByCurrentElement("saveAs",t)}try{i.close()}catch(e){}},e)}}),new BX.PopupWindowButton({text:BX.message("JS_CORE_VIEWER_IFRAME_CANCEL"),events:{click:BX.delegate(function(){this.runActionByCurrentElement("discard",this.getCurrent().getDataForCommit());this.closeConfirm();BX.CViewer.unlockScroll();try{i.close()}catch(e){}},e)}})],true);return false};BX.CViewBlankElement.prototype.saveFile=function(e){e=e||{};if(!e||!e.obElementViewer){return false}var t;var i=e.idDoc||e.id;if(this.editUrl){t=r.getUrlCommitBlank(this.editUrl,this.docType,this.targetFolderId)}else{t=BX.util.remove_url_param(e.uriToDoc,"editIn");if(!t||!i){return false}t=this.addToLinkParam(t,"proccess","1");t=this.addToLinkParam(t,"toWDController","1");t=this.addToLinkParam(t,"type",this.docType);t=this.addToLinkParam(t,"createIn",e.obElementViewer.initEditService());t=this.addToLinkParam(t,"createDoc","1");t=this.addToLinkParam(t,"commit","1");t=this.addToLinkParam(t,"id",i);t=this.addToLinkParam(t,"sessid",BX.bitrix_sessid())}BX.ajax({method:"POST",dataType:"json",url:t,data:{editSessionId:e.editSessionId,id:i,sessid:BX.bitrix_sessid()},onsuccess:BX.delegate(function(t){this.oldName=t.name;this.sectionId=t.sectionId;this.elementId=t.elementId;this.elementId=t.elementId;this.objectId=t.objectId;var i=BX.create("div",{props:{className:"bx-viewer-confirm"},children:[BX.create("div",{props:{className:"bx-viewer-confirm-title"},text:BX.message("JS_CORE_VIEWER_NOW_CREATING_IN_SERVICE").replace("#SERVICE#",e.obElementViewer.getNameEditService()),children:[]}),BX.create("div",{props:{className:"bx-viewer-confirm-text-wrap bx-viewer-confirm-center"},children:[BX.create("input",{props:{id:"wd-new-create-filename",className:"bx-viewer-inp",type:"text",value:t.nameWithoutExtension}}),BX.create("span",{props:{className:"bx-viewer-confirm-extension"},text:this.docType})]})]});BX.CViewer.lockScroll();e.obElementViewer.params.keyMap={13:"submitCurrentElement",27:"close"};e.obElementViewer._bindEvents();e.obElementViewer.openConfirm(i,[new BX.PopupWindowButton({id:"wd-btn-save-blank-with-new-name",text:BX.message("JS_CORE_VIEWER_SAVE"),className:"popup-window-button-accept",events:{click:BX.delegate(function(){var r=BX("wd-new-create-filename").value;if(!r){BX.focus(BX("wd-new-create-filename"));return}BX.CViewer.showLoading(BX.findChild(i,{className:"bx-viewer-confirm-text-wrap"},true),{className:"bx-viewer-wrap-loading-modal",notAddClassLoadingToObj:true});this.runActionByCurrentElement("rename",{newName:r,data:t,success:BX.delegate(function(t,i){if(i&&i.newName&&i.newName!=t.name){t.name=i.newName;t.nameWithoutExtension=i.newName.split(".").pop()}this.runActionByCurrentElement("pasteInForm",{response:t});BX.CViewer.unlockScroll();e.obElementViewer._unbindEvents();this.closeConfirm()},this)});try{modalWindow.close()}catch(e){}},e.obElementViewer)}}),new BX.PopupWindowButton({text:BX.message("JS_CORE_VIEWER_IFRAME_CANCEL"),events:{click:BX.delegate(function(){this.runActionByCurrentElement("discard",this.getCurrent().getDataForCommit());BX.CViewer.unlockScroll();e.obElementViewer._unbindEvents();this.closeConfirm()},e.obElementViewer)}})],true)},this)});return false};BX.CViewBlankElement.prototype.renameFile=function(e){e=e||{};if(!e.newName||!this.oldName){return false}if(e.newName==this.oldName||e.newName+"."+this.docType==this.oldName){if(BX.type.isFunction(e.success)){e.success(e.data,{status:"success"})}return true}var t;if(this.renameUrl){t=r.getUrlRenameFile(this.renameUrl)}else{if(this.uriToDoc){t=this.addToLinkParam(this.uriToDoc,"action","rename")}else{t=this.addToLinkParam(e.data.link,"action","rename")}t=this.addToLinkParam(t,"proccess","1");t=this.addToLinkParam(t,"createDoc","1");t=this.addToLinkParam(t,"createIn",this.docService);t=this.addToLinkParam(t,"elementId",this.elementId);t=this.addToLinkParam(t,"sectionId",this.sectionId);t=this.addToLinkParam(t,"rename",1);t=this.addToLinkParam(t,"toWDController",1);t=this.addToLinkParam(t,"newName",e.newName+"."+this.docType);t=this.addToLinkParam(t,"sessid",BX.bitrix_sessid())}BX.ajax({method:"POST",dataType:"json",url:t,data:{objectId:this.objectId,newName:e.newName+"."+this.docType,sessid:BX.bitrix_sessid()},onsuccess:BX.delegate(function(t){if(BX.type.isFunction(e.success)){e.success(e.data,t)}},this)});return true};BX.CViewBlankElement.prototype.pasteInForm=function(e){e=e||{};this.afterSuccessCreate(e.response);return};BX.CViewIframeElement=function(e){BX.CViewIframeElement.superclass.constructor.apply(this,arguments);this.width=850;this._minWidth=850;this.height=700;this._minHeight=700;this.topPadding=43;this.viewerUrl="";this.autoReduction=true;this.autoReductionWidth=350;this.pdfFallback=e.pdfFallback;this.previewImage=e.previewImage;this.transformTimeout=e.transformTimeout||0;this.getLastVersionUri=e.getLastVersionUri};BX.extend(BX.CViewIframeElement,BX.CViewEditableElement);BX.CViewIframeElement.prototype.load=function(e,t){if(!this.loaded){var i=BX.proxy(function(){BX.ajax({method:"POST",dataType:"json",url:this.src,data:{sessid:BX.bitrix_sessid(),json:1},onsuccess:BX.delegate(function(e){BX.onCustomEvent(this,"onIframeElementLoadDataToView",[this,e]);if(e&&e.viewerType==="ajax"){BX.onCustomEvent(this,"onIframeElementCreateAjaxElement",[this,e.viewerParams]);return}if(e&&e.viewerType==="local"){BX.onCustomEvent(this,"onIframeElementPerformLocalAction",[this]);return}if(e&&(e.error||e.status==="error")){if(BX.type.isFunction(t)){t(this,e)}return}if(e&&e.status==="restriction"){return}if(e&&e.authUrlOpenerMode){BX.removeClass(this.contentWrap,"bx-viewer-wrap-loading");this.contentWrap.innerHTML='<div style="font-weight: bold;font-size: 17px;padding: 20px 25px;">'+BX.message("JS_CORE_VIEWER_SHOW_FILE_DIALOG_OAUTH_NOTICE").replace("#SERVICE#",e.serviceName)+"</div>";BX.bind(BX("bx-js-disk-run-oauth-modal"),"click",function(t){BX.util.popup(e.authUrlOpenerMode,1030,700);BX.PreventDefault(t);return false});BX.bind(window,"hashchange",BX.proxy(function(){var e=document.location.hash.match(/external-auth-(\w+)/);if(!e)return;BX.CViewer.objNowInShow.show(this,true)},this));return}var i=function(){};if(e.neededCheckView!==undefined&&e.neededCheckView){i=BX.delegate(function(){if(BX.localStorage.get("iframe_options_error")){BX.onCustomEvent(this,"onIframeDocError",[this]);return}if(BX.localStorage.get("iframe_options_error")!==null){return}BX.ajax({method:"POST",dataType:"json",url:r.getUrlCheckView(this.src),data:{extLink:e.file,sessid:BX.bitrix_sessid(),checkViewByGoogle:1,id:e.id},onsuccess:BX.delegate(function(e){if(!e||(e.viewed===undefined&&!e.viewByGoogle||e.viewByGoogle===undefined&&!e.viewed)){BX.onCustomEvent(this,"onIframeDocError",[this])}else{BX.onCustomEvent(this,"onIframeDocSuccess",[this])}},this)})},this)}if(BX.localStorage.get("iframe_options_error")){BX.onCustomEvent(this,"onIframeDocError",[this]);return}if(e.neededOpenWindow){window.open(e.viewUrl,"_blank");this.domElement=BX.create("span")}else{this.domElement=BX.create("iframe",{props:{className:"bx-viewer-image",src:e.viewUrl||e.viewerUrl},events:{load:!BX.CViewer.browserWithDeferredCheckIframeError()?BX.proxy(function(){BX.proxy(this.onLoad,this);i()},this):BX.proxy(this.onLoad,this)},style:{border:"none"}})}var s=BX.findChildByClassName(this.contentWrap,"bx-viewer-file-transformation-in-process-message");if(s){s.remove()}this.contentWrap.appendChild(this.domElement);this.viewUrl=e.viewUrl||e.viewerUrl;if(BX.localStorage.get("iframe_options_error")){BX.onCustomEvent(this,"onIframeDocError",[this])}else if(BX.CViewer.browserWithDeferredCheckIframeError()&&BX.localStorage.get("iframe_options_error")===null){this.addTimeoutId(setTimeout(i,15e3))}else{this.addTimeoutId(setTimeout(BX.proxy(function(){try{if(!!this.domElement.contentDocument&&this.domElement.contentDocument.URL=="about:blank"){BX.onCustomEvent(this,"onIframeDocError",[this])}}catch(e){}},this),15e3))}},this)})},this);if(this.transformTimeout>0){this.contentWrap.innerHTML='<div class="bx-viewer-file-transformation-in-process-message" style="text-align: center;margin-top: 50%;">'+BX.message("JS_CORE_VIEWER_TRANSFORMATION_IN_PROCESS")+"</div>";setTimeout(i,this.transformTimeout*1e3)}else{i()}this.titleDomElement=BX.create("span",{props:{className:"bx-viewer-file-name-block",title:this.title},children:[BX.create("span",{props:{className:"bx-viewer-file-name",title:this.title},text:this.title}),BX.create("span",{props:{className:"bx-viewer-file-last-v",title:this.title,alt:this.title},text:this.version?BX.message("JS_CORE_VIEWER_THROUGH_VERSION").replace("#NUMBER#",this.version>0?this.version:""):BX.message("JS_CORE_VIEWER_THROUGH_LAST_VERSION")})]});this.titleButtons=BX.create("span",{props:{className:"bx-viewer-top-right"},style:{},children:this.buttons});this.successLoad=e||BX.CViewIframeElement.prototype.successLoad;this.isProccessed=true}};BX.CViewIframeElement.prototype.preload=function(e){return false};BX.CViewIframeElement.prototype.onLoad=function(){if(this.loaded){return}this.loaded=true;this.successLoad(this)};BX.CViewIframeElement.prototype.show=function(){this.domElement.style.opacity=1;this.domElement.style.display="block";this.preventShow=false};BX.CViewIframeElement.prototype.hide=function(e){e=e||false;if(this.domElement){this.domElement.style.opacity=0;BX.unbind(this.domElement,"load",BX.proxy(this.onLoad,this))}this.preventTimeout();this.loaded=false;this.preventShow=false;this.isProccessed=false};BX.CViewAjaxElement=function(e){BX.CViewAjaxElement.superclass.constructor.apply(this,arguments);this.width=e.width||900;this._minWidth=e.width||900;this.height=e.height||700;this._minHeight=e.height||700;this.topPadding=43;this.viewerUrl="";this.autoReduction=true;this.autoReductionWidth=350;this.pdfFallback=e.pdfFallback;this.full=this.pdfFallback;this.iframeSrc=e.iframeSrc;this.transformTimeout=e.transformTimeout;this.wrapClassName="";this.image=null;this.getLastVersionUri=e.getLastVersionUri};BX.extend(BX.CViewAjaxElement,BX.CViewEditableElement);BX.CViewAjaxElement.prototype.load=function(e){var t=this;if(!this.loaded){BX.ajax({method:"GET",dataType:"json",url:t.src,data:{sessid:BX.bitrix_sessid()},onsuccess:BX.delegate(function(e){if(!e||!e.html){e=e||{};if(!e.message||e.message.length==0){if(!!e.status&&e.status==="denied"){e.message=BX.message("JS_CORE_VIEWER_AJAX_ACCESS_DENIED")}else if(e.errors&&BX.type.isArray(e.errors)){e.message="";for(var i in e.errors){e.message+=e.errors[i].message+" "}}}this.errorMessage=e.message;BX.onCustomEvent(t,"onAjaxElementError",[this]);return}else{if(e.wrapClassName&&this.contentWrap.parentNode.parentNode){this.wrapClassName=e.wrapClassName;BX.addClass(this.contentWrap.parentNode.parentNode,e.wrapClassName)}var r=BX.processHTML(e.html);if(!!e.innerElementId){this.innerElementId=e.innerElementId;BX.addCustomEvent("onElementViewClose",BX.delegate(function(){var e;if(typeof videojs!=="undefined"&&(e=BX(this.innerElementId))){videojs(e.id).pause()}},this))}this.domElement=BX.create("div",{props:{className:"bx-viewer-image"},style:{border:"none"},html:r.HTML});this.contentWrap.appendChild(this.domElement);if(!!r.SCRIPT){BX.ajax.processScripts(r.SCRIPT)}}},this),onfailure:BX.delegate(function(){this.errorMessage=BX.message("JS_CORE_VIEWER_AJAX_CONNECTION_FAILED");BX.onCustomEvent(t,"onAjaxElementError",[t]);return},this)});this.titleDomElement=BX.create("span",{props:{className:"bx-viewer-file-name-block",title:this.title},children:[BX.create("span",{props:{className:"bx-viewer-file-name",title:this.title},text:this.title}),BX.create("span",{props:{className:"bx-viewer-file-last-v",title:this.title,alt:this.title},text:this.version?BX.message("JS_CORE_VIEWER_THROUGH_VERSION").replace("#NUMBER#",this.version>0?this.version:""):BX.message("JS_CORE_VIEWER_THROUGH_LAST_VERSION")})]});this.titleButtons=BX.create("span",{props:{className:"bx-viewer-top-right"},style:{},children:this.buttons});this.successLoad=e||BX.CViewIframeElement.prototype.successLoad;this.isProccessed=true}};BX.CViewAjaxElement.prototype.preload=function(e){return false};BX.CViewAjaxElement.prototype.onLoad=function(){if(this.loaded){return}this.loaded=true;this.successLoad(this)};BX.CViewAjaxElement.prototype.show=function(){this.domElement.style.opacity=1;this.domElement.style.display="block";this.preventShow=false};BX.CViewAjaxElement.prototype.hide=function(e){if(this.wrapClassName){BX.removeClass(this.contentWrap.parentNode.parentNode,this.wrapClassName)}e=e||false;if(this.domElement){this.domElement.style.opacity=0;BX.unbind(this.domElement,"load",BX.proxy(this.onLoad,this))}this.preventTimeout();this.loaded=false;this.preventShow=false;this.isProccessed=false};BX.CViewAjaxElement.prototype.getBottomHtml=function(){if(!this.full){return""}var e='<a href="'+this.full+'" class="bx-viewer-full-link" target="_blank">'+BX.message("JS_CORE_VIEWER_AJAX_OPEN_NEW_TAB")+"</a>";return e};BX.CViewWithoutPreviewEditableElement=function(e){BX.CViewWithoutPreviewEditableElement.superclass.constructor.apply(this,arguments);this.width=600;this._minWidth=600;this.height=350;this._minHeight=350;this.owner=e.owner;this.dateModify=e.dateModify;this.size=e.size;this.topPadding=43;this.tooBigSizeMsg=!!e.tooBigSizeMsg;this.autoReduction=true;this.autoReductionWidth=175};BX.extend(BX.CViewWithoutPreviewEditableElement,BX.CViewEditableElement);BX.CViewWithoutPreviewEditableElement.prototype.load=function(e){if(this.loaded){return}this.titleDomElement=BX.create("span",{props:{className:"bx-viewer-file-name-block",title:this.title},children:[BX.create("span",{props:{className:"bx-viewer-file-name",title:this.title},text:this.title}),BX.create("span",{props:{className:"bx-viewer-file-last-v",title:this.title,alt:this.title},text:this.version?BX.message("JS_CORE_VIEWER_THROUGH_VERSION").replace("#NUMBER#",this.version>0?this.version:""):BX.message("JS_CORE_VIEWER_THROUGH_LAST_VERSION")})]});this.titleButtons=BX.create("span",{props:{className:"bx-viewer-top-right"},children:this.buttons});var t=this.src;this.domElement=BX.create("div",{props:{className:"bx-viewer-cap-wrap bx-viewer-cap-file"},children:[BX.create("div",{props:{},children:[BX.create("div",{props:{className:"bx-viewer-icon "+this.getIconClassByName(this.title)}}),BX.create("div",{props:{className:"bx-viewer-cap-text-block"},children:[BX.create("div",{props:{className:"bx-viewer-cap-title",title:this.title},text:this.title}),BX.create("div",{props:{className:"bx-viewer-too-big-title"},style:{display:this.tooBigSizeMsg?"":"none"},text:BX.message("JS_CORE_VIEWER_TOO_BIG_FOR_VIEW")}),BX.create("div",{props:{className:"bx-viewer-cap-text"},html:'<span class="bx-viewer-cap-text-title">'+BX.message("JS_CORE_VIEWER_DESCR_AUTHOR")+": </span> "+BX.util.htmlspecialchars(this.owner)+"<br/>"+'<span class="bx-viewer-cap-text-title">'+BX.message("JS_CORE_VIEWER_DESCR_LAST_MODIFY")+": </span> "+BX.util.htmlspecialchars(this.dateModify)+"<br/>"+this.size}),BX.create("span",{props:{className:"bx-viewer-btn"},events:{click:BX.delegate(function(e){document.location.href=this.downloadUrl;return false},this)},text:BX.message("JS_CORE_VIEWER_DOWNLOAD")})]})]})]});this.successLoad=e||BX.CViewUnknownElement.prototype.successLoad;this.contentWrap.appendChild(this.domElement);this.loaded=true;this.successLoad(this)};BX.CViewWithoutPreviewEditableElement.prototype.preload=function(e){};BX.CViewWithoutPreviewEditableElement.prototype.onLoad=function(){};BX.CViewWithoutPreviewEditableElement.prototype.show=function(){this.domElement.style.opacity=1;this.domElement.style.display="block";this.titleButtons.style.display="block";this.preventShow=false};BX.CViewWithoutPreviewEditableElement.prototype.hide=function(e){e=e||false;this.domElement.style.opacity=0;this.titleButtons.style.display="none";this.preventTimeout();this.loaded=false;this.preventShow=false;this.isProccessed=false};BX.CViewIframeExtLinksElement=function(e){BX.CViewIframeExtLinksElement.superclass.constructor.apply(this,arguments);this.width=800;this._minWidth=800;this.height=600;this._minHeight=600;this.topPadding=43;this.viewerUrl=e.viewerUrl;this.askConvert=false;this.editUrl=false};BX.extend(BX.CViewIframeExtLinksElement,BX.CViewIframeElement);BX.CViewIframeExtLinksElement.prototype.load=function(e){var t=this;if(!this.loaded){var i=function(){if(BX.localStorage.get("iframe_options_error")){BX.onCustomEvent(t,"onIframeDocError",[t]);return}if(BX.localStorage.get("iframe_options_error")!==null){return}BX.ajax({method:"POST",dataType:"json",url:t.src,data:{sessid:BX.bitrix_sessid(),checkViewByGoogle:1},onsuccess:function(e){if(!e||!e.viewByGoogle){BX.onCustomEvent(t,"onIframeDocError",[t])}else{BX.onCustomEvent(t,"onIframeDocSuccess",[t])}}})};this.domElement=BX.create("iframe",{props:{className:"bx-viewer-image",src:this.viewerUrl},events:{load:!BX.CViewer.browserWithDeferredCheckIframeError()?BX.proxy(function(){BX.proxy(this.onLoad,this);i()},t):BX.proxy(t.onLoad,t)},style:{border:"none"}});this.contentWrap.appendChild(this.domElement);if(BX.localStorage.get("iframe_options_error")){BX.onCustomEvent(this,"onIframeDocError",[this])}else if(BX.CViewer.browserWithDeferredCheckIframeError()&&BX.localStorage.get("iframe_options_error")===null){this.addTimeoutId(setTimeout(i,15e3))}this.titleDomElement=BX.create("span",{props:{className:"bx-viewer-file-name-block",title:this.title},children:[BX.create("span",{props:{className:"bx-viewer-file-name",title:this.title},text:this.title}),BX.create("span",{props:{className:"bx-viewer-file-last-v",title:this.title}})]});this.titleButtons=BX.create("span",{props:{className:"bx-viewer-top-right"},style:{},children:this.buttons});this.successLoad=e||BX.CViewIframeExtLinksElement.prototype.successLoad;this.isProccessed=true}};BX.CViewIframeExtLinksElement.prototype.commitFile=function(e){return false};BX.CViewErrorIframeElement=function(e){BX.CViewErrorIframeElement.superclass.constructor.apply(this,arguments);this.width=600;this._minWidth=600;this.height=350;this._minHeight=350;this.topPadding=43;this.buttonUrl=e.buttonUrl;this.autoReduction=true;this.autoReductionWidth=175;this.pdfFallback=e.pdfFallback;if(!e.errorDescription){this.errorDescription=BX.create("div",{props:{className:"bx-viewer-cap-text-block"},children:[BX.create("div",{props:{className:"bx-viewer-cap-title",title:this.title},text:BX.message("JS_CORE_VIEWER_IFRAME_ERROR_TITLE")}),BX.create("div",{props:{className:"bx-viewer-too-big-title"},text:BX.message("JS_CORE_VIEWER_SERVICE_LOCAL_INSTALL_DESKTOP")}),BX.create("a",{props:{className:"bx-viewer-btn"},events:{click:BX.delegate(function(e){document.location.href=BX.browser.IsMac()?"http://dl.bitrix24.com/b24/bitrix24_desktop.dmg":"http://dl.bitrix24.com/b24/bitrix24_desktop.exe";return false},this)},text:BX.message("JS_CORE_VIEWER_DOWNLOAD_B24_DESKTOP_FULL")}),BX.create("span",{props:{className:"bx-viewer-btn"},events:{click:BX.delegate(function(e){document.location.href=this.downloadUrl;return false},this)},text:BX.message("JS_CORE_VIEWER_DOWNLOAD_DOCUMENT")})]})}else{this.errorDescription=e.errorDescription}};BX.extend(BX.CViewErrorIframeElement,BX.CViewEditableElement);BX.CViewErrorIframeElement.prototype.load=function(e){this.titleDomElement=BX.create("span",{props:{className:"bx-viewer-file-name-block",title:this.title},children:[BX.create("span",{props:{className:"bx-viewer-file-name",title:this.title},text:this.title}),BX.create("span",{props:{className:"bx-viewer-file-last-v",title:this.title,alt:this.title},text:this.version?BX.message("JS_CORE_VIEWER_THROUGH_VERSION").replace("#NUMBER#",this.version>0?this.version:""):BX.message("JS_CORE_VIEWER_THROUGH_LAST_VERSION")})]});this.titleButtons=BX.create("span",{props:{className:"bx-viewer-top-right"},children:this.buttons});this.domElement=BX.create("div",{props:{className:"bx-viewer-cap-wrap bx-viewer-cap-file"},children:[BX.create("div",{props:{},children:[BX.create("div",{props:{className:"bx-viewer-icon "+this.getIconClassByName(this.title)}}),this.errorDescription]})]});this.successLoad=e||BX.CViewUnknownElement.prototype.successLoad;this.contentWrap.appendChild(this.domElement);this.loaded=true;this.successLoad(this)};BX.CViewErrorIframeElement.prototype.show=function(){this.domElement.style.opacity=1;this.domElement.style.display="block";this.titleButtons.style.display="block";this.preventShow=false};BX.CViewErrorIframeElement.prototype.hide=function(){this.domElement.style.opacity=0;this.preventTimeout();this.loaded=false;this.preventShow=false;this.isProccessed=false};BX.CViewUnknownElement=function(e){BX.CViewUnknownElement.superclass.constructor.apply(this,arguments);this.width=600;this._minWidth=600;this.height=350;this._minHeight=350;this.owner=e.owner;this.dateModify=e.dateModify;this.size=e.size;this.topPadding=43;this.tooBigSizeMsg=!!e.tooBigSizeMsg};BX.extend(BX.CViewUnknownElement,BX.CViewCoreElement);BX.CViewUnknownElement.prototype.load=function(e){if(this.loaded){return}this.titleDomElement=BX.create("span",{props:{className:"bx-viewer-file-name-block bx-viewer-file-center",title:this.title},children:[BX.create("span",{props:{className:"bx-viewer-file-name",title:this.title},text:this.title}),BX.create("span",{props:{className:"bx-viewer-file-last-v",title:this.title}})]});this.titleButtons=BX.create("span",{props:{className:"bx-viewer-top-right"},children:this.buttons});var t=this.src;this.domElement=BX.create("div",{props:{className:"bx-viewer-cap-wrap bx-viewer-cap-file"},children:[BX.create("div",{props:{},children:[BX.create("div",{props:{className:"bx-viewer-icon "+this.getIconClassByName(this.title)}}),BX.create("div",{props:{className:"bx-viewer-cap-text-block"},children:[BX.create("div",{props:{className:"bx-viewer-cap-title",title:this.title},text:this.title}),BX.create("div",{props:{className:"bx-viewer-too-big-title"},style:{display:this.tooBigSizeMsg?"":"none"},text:BX.message("JS_CORE_VIEWER_TOO_BIG_FOR_VIEW")}),BX.create("div",{props:{className:"bx-viewer-cap-text"},html:'<span class="bx-viewer-cap-text-title">'+BX.message("JS_CORE_VIEWER_DESCR_AUTHOR")+": </span> "+BX.util.htmlspecialchars(this.owner)+"<br/>"+'<span class="bx-viewer-cap-text-title">'+BX.message("JS_CORE_VIEWER_DESCR_LAST_MODIFY")+": </span> "+BX.util.htmlspecialchars(this.dateModify)+"<br/>"+this.size}),BX.create("span",{props:{className:"bx-viewer-btn"},events:{click:function(e){document.location.href=t;return false}},text:BX.message("JS_CORE_VIEWER_DOWNLOAD")})]})]})]});this.successLoad=e||BX.CViewUnknownElement.prototype.successLoad;this.contentWrap.appendChild(this.domElement);this.loaded=true;this.successLoad(this)};BX.CViewUnknownElement.prototype.preload=function(e){};BX.CViewUnknownElement.prototype.onLoad=function(){};BX.CViewUnknownElement.prototype.show=function(){this.domElement.style.opacity=1;this.domElement.style.display="block";this.titleButtons.style.display="block";this.preventShow=false};BX.CViewUnknownElement.prototype.hide=function(e){e=e||false;if(this.loaded){this.domElement.style.opacity=0;this.titleButtons.style.display="none"}this.preventTimeout();this.loaded=false;this.preventShow=false;this.isProccessed=false};BX.CViewFolderElement=function(e){BX.CViewFolderElement.superclass.constructor.apply(this,arguments);this.width=600;this._minWidth=600;this.height=350;this._minHeight=350;this.owner=e.owner;this.dateModify=e.dateModify;this.size=e.size;this.topPadding=0;this.showTitle=false};BX.extend(BX.CViewFolderElement,BX.CViewCoreElement);BX.CViewFolderElement.prototype.load=function(e){if(this.loaded){return}this.titleDomElement=null;this.titleButtons=null;this.domElement=BX.create("div",{props:{className:"bx-viewer-cap-wrap bx-viewer-folder"},children:[BX.create("div",{props:{className:"bx-viewer-cap"},children:[BX.create("div",{props:{className:"bx-viewer-icon"}}),BX.create("div",{props:{className:"bx-viewer-cap-text-block"},children:[BX.create("div",{props:{className:"bx-viewer-cap-title",title:this.title},text:this.title}),BX.create("div",{props:{className:"bx-viewer-cap-text"},html:BX.message("JS_CORE_VIEWER_DESCR_AUTHOR")+": "+BX.util.htmlspecialchars(this.owner)+"<br/>"+BX.message("JS_CORE_VIEWER_DESCR_LAST_MODIFY")+": "+BX.util.htmlspecialchars(this.dateModify)+"<br/>"})]})]})]});this.contentWrap.appendChild(this.domElement);this.loaded=true};BX.CViewFolderElement.prototype.preload=function(e){};BX.CViewFolderElement.prototype.onLoad=function(){};BX.CViewFolderElement.prototype.show=function(){this.domElement.style.opacity=1;this.domElement.style.display="block";this.preventShow=false};BX.CViewFolderElement.prototype.hide=function(e){e=e||false;this.domElement.style.opacity=0;this.preventTimeout();this.loaded=false;this.preventShow=false;this.isProccessed=false};BX.CViewer=function(e){this.params=BX.clone(BX.CViewer.defaultSettings);for(var t in e){this.params[t]=e[t]}this.DIV=null;this.OVERLAY=null;this.CONTENT_WRAP=null;this.list=this.params.list;this._current=0;this._currentEl=null;this.FULL_TITLE=null;this.bVisible=false;this.createDoc=this.params.createDoc||false;this.preload=0;this.currentElement=null;this.popupConfirm=null;this.popupMenu=null};BX.CViewer.temporaryServiceEditDoc="";BX.CViewer._convertElementsMatch={};BX.CViewer.rightNowRunActionAfterShow="";BX.CViewer.objNowInShow=false;BX.CViewer.isDisabledLocalEdit=false;BX.CViewer.localChangeServiceEdit=false;BX.CViewer.listPopupId=[];BX.CViewer.defaultSettings={list:[],cycle:true,resize:"WH",resizeToggle:false,showTitle:true,preload:0,minMargin:20,minPadding:11,lockScroll:true,keyMap:{13:"submitCurrentElement",27:"close",33:"prev",37:"prev",38:"prev",34:"next",39:"next",40:"next",32:"next"}};BX.CViewer.goToBx=function(e){if(!!BX.desktopUtils){BX.desktopUtils.goToBx(e);return}location.href=e};BX.CViewer.browserWithDeferredCheckIframeError=function(){if(BX.browser.IsFirefox()){return false}if(BX.browser.IsChrome()&&window.navigator&&window.navigator.appVersion){return parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1],10)<28}return true};BX.CViewer.enableInVersionDesktop=function(e){return typeof BXIM!=="undefined"&&!BXIM.desktop.ready()&&BXIM.desktopVersion>=parseInt(e)};BX.CViewer.enableInVersionDisk=function(e){var t=BX.message.disk_revision_api;if(!t){t=0}t=parseInt(t,10);return t>=parseInt(e,10)};BX.CViewer.disableLocalEdit=function(){BX.CViewer.isDisabledLocalEdit=true};BX.CViewer.isEnableLocalEditInDesktop=function(){if(BX.CViewer.isDisabledLocalEdit){return false}return BX.CViewer.enableInVersionDesktop(21)&&(!!BX.message("wd_desktop_disk_is_installed")||typeof BXIM!=="undefined"&&BXIM.desktopStatus)};BX.CViewer.hasLockScroll=function(){return BX.hasClass(document.body,"bx-viewer-lock-scroll")};BX.CViewer.lockScroll=function(){BX.addClass(document.body,"bx-viewer-lock-scroll")};BX.CViewer.unlockScroll=function(){BX.removeClass(document.body,"bx-viewer-lock-scroll")};BX.CViewer.getMsgAfterUploadNewVersionByUser=function(){var e=BX.message("wd_gender_current_user");switch(e){case"f":case"F":return BX.message("JS_CORE_VIEWER_IFRAME_UPLOAD_NEW_VERSION_IN_COMMENT_F");break;case"m":case"M":return BX.message("JS_CORE_VIEWER_IFRAME_UPLOAD_NEW_VERSION_IN_COMMENT_M");break}return BX.message("JS_CORE_VIEWER_IFRAME_UPLOAD_NEW_VERSION_IN_COMMENT")};BX.CViewer.getWindowCopyToDisk=function(e){var t=e.link;var i=BX.create("div",{props:{className:"bx-viewer-alert"},children:[BX.create("span",{props:{className:"bx-viewer-alert-icon"},children:[BX.create("img",{props:{src:"/bitrix/js/main/core/images/yell-waiter.gif"}})]}),BX.create("span",{props:{className:"bx-viewer-aligner"}}),BX.create("span",{props:{className:"bx-viewer-alert-text"},html:BX.message("JS_CORE_VIEWER_DESCR_PROCESS_SAVE_FILE_TO_OWN_FILES").replace("#NAME#",'<a href="#" class="bx-viewer-file-link">'+e.title+"</a>")}),BX.create("a",{props:{className:"bx-viewer-alert-close-icon",href:"#"},events:{click:function(t){if(e.selfViewer){e.selfViewer.closeConfirm()}else{BX.CViewer.unlockScroll();BX.PopupWindowManager.getCurrentPopup().destroy()}BX.PreventDefault(t);return false}}})]});BX.CViewer.lockScroll();if(e.selfViewer){e.selfViewer.openConfirm(i,[],true,null,{windowName:"-copy",className:"bx-viewer-alert-popup"})}else{var r={content:i,onPopupClose:function(){this.destroy()},closeByEsc:e.closeByEsc||false,autoHide:e.autoHide||false,overlay:true,zIndex:10200,className:"bx-viewer-alert-popup"};var s=BX.PopupWindowManager.create("bx-gedit-convert-confirm-copy",null,r);s.show()}BX.ajax.loadJSON(t,{sessid:BX.bitrix_sessid()},function(t){if(typeof item=="object"&&t.status!="success"){return}var i=BX.create("div",{props:{className:"bx-viewer-alert"},children:[BX.create("span",{props:{className:"bx-viewer-alert-icon"},children:[BX.create("img",{props:{src:"/bitrix/js/main/core/images/viewer-tick.png"}})]}),BX.create("span",{props:{className:"bx-viewer-aligner"}}),BX.create("span",{props:{className:"bx-viewer-alert-text"},html:BX.message("JS_CORE_VIEWER_DESCR_SAVE_FILE_TO_OWN_FILES").replace("#NAME#",'<a target="_blank" href="'+t.viewUrl+'" class="bx-viewer-file-link">'+e.title+"</a>")}),BX.create("div",{props:{className:"bx-viewer-alert-footer"},children:[BX.create("a",{props:{className:"bx-viewer-btn-link",target:"_blank",href:t.viewUrl},text:BX.message("JS_CORE_VIEWER_GO_TO_FILE")}),e.showEdit?BX.create("a",{props:{className:"bx-viewer-btn-link",target:"_blank",href:t.runViewUrl?t.runViewUrl:t.viewUrl+"#showInViewer"},text:BX.message("JS_CORE_VIEWER_EDIT")}):null]}),BX.create("a",{props:{className:"bx-viewer-alert-close-icon",href:"#"},events:{click:function(t){if(e.selfViewer){e.selfViewer.closeConfirm()}else{BX.PopupWindowManager.getCurrentPopup().destroy()}BX.PreventDefault(t);return false}}})]});if(e.selfViewer){e.selfViewer.openConfirm(i,[],false,null,{windowName:"-copy",className:"bx-viewer-alert-popup"})}else{BX.CViewer.unlockScroll();var r={content:i,onPopupClose:function(){this.destroy()},closeByEsc:e.closeByEsc||false,autoHide:e.autoHide||false,zIndex:10200,className:"bx-viewer-alert-popup"};BX.PopupWindowManager.getCurrentPopup().destroy();var s=BX.PopupWindowManager.create("bx-gedit-convert-confirm-copy",null,r);s.show()}var o=setTimeout(function(){var e=BX.PopupWindowManager.getCurrentPopup();e.close();e.destroy()},3e3);BX("bx-gedit-convert-confirm-copy").onmouseover=function(e){clearTimeout(o)};BX("bx-gedit-convert-confirm-copy").onmouseout=function(e){o=setTimeout(function(){var e=BX.PopupWindowManager.getCurrentPopup();e.close();e.destroy()},3e3)}})};BX.CViewer.isEmptyObject=function(e){if(e==null)return true;if(e.length&&e.length>0)return false;if(e.length===0)return true;for(var t in e){if(hasOwnProperty.call(e,t))return false}return true};BX.CViewer.showLoading=function(e,t){t=t||{};t.notAddClassLoadingToObj=!!t.notAddClassLoadingToObj||false;if(!(e=BX(e))){return false}if(!t.notAddClassLoadingToObj){BX.addClass(e,"bx-viewer-wrap-loading")}BX.cleanNode(e);BX.adjust(e,{children:[BX.create("div",{style:{display:"table",width:"100%",height:"100%"},children:[BX.create("div",{style:{display:"table-cell",verticalAlign:"middle",textAlign:"center"},children:[BX.create("div",{props:{className:t.className||"bx-viewer-wrap-loading"}}),BX.create("span",{text:t.text||""})]})]})]});return true};BX.CViewer.prototype.initEventHandlersForElement=function(e){if(e.hasEventHandlers===true){return}e.hasEventHandlers=true;BX.addCustomEvent(e,"onIframeDocSuccess",BX.delegate(function(e){BX.localStorage.set("iframe_options_error",false,60)},this));BX.addCustomEvent(e,"onIframeElementPerformLocalAction",BX.delegate(function(e){if((!e.id||this.getCurrent().id!=e.id)&&this.getCurrent().src!=e.src){return}if(BX.CViewer.isLocalEditService(this.initEditService())){if(!e.editUrl&&e.fakeEditUrl){e.editUrl=e.fakeEditUrl}if(!e.editUrl){this.close();this.runActionByCurrentElement("localview",{obElementViewer:this})}else{this.close();this.runActionByCurrentElement("forceedit",{obElementViewer:this})}}},this));BX.addCustomEvent(e,"onIframeDocError",BX.delegate(function(e){if((!e.id||this.getCurrent().id!=e.id)&&this.getCurrent().src!=e.src){return}this.getCurrent().preventTimeout();this.getCurrent().hide();this.createPopupWindowFromErrorElement(e);BX.localStorage.set("iframe_options_error",true,60)},this));BX.addCustomEvent(e,"onAjaxElementError",BX.delegate(function(e){if((!e.id||this.getCurrent().id!=e.id)&&this.getCurrent().src!=e.src){return}this.getCurrent().preventTimeout();this.getCurrent().hide();this.createPopupWindowFromErrorElement(e)},this));BX.addCustomEvent(e,"onIframeElementCreateAjaxElement",BX.delegate(function(e,t){if((!e.id||this.getCurrent().id!=e.id)&&this.getCurrent().src!=e.src){return}var i=this.createAjaxElementFromIframeElement(e,t);i.setCurrentModalWindow(e.getCurrentModalWindow());this.getCurrent().hide();this.setCurrent(i);this.show()},this))};BX.CViewer.showError=function(e,t){t=t||{};if(!(e=BX(e))){return false}BX.cleanNode(e);BX.adjust(e,{children:[BX.create("div",{style:{display:"table",width:"100%",height:"100%"},children:[BX.create("div",{style:{display:"table-cell",verticalAlign:"middle",textAlign:"center"},children:[BX.create("div",{props:{}}),BX.create("span",{text:t.text||""})]})]})]});return true};BX.CViewer.prototype._create=function(){if(!this.DIV){var e=BX.browser.IsIE()&&!BX.browser.IsDoctype()?"A":"SPAN",t=e=="A"?"javascript:void(0)":null;this.OVERLAY=document.body.appendChild(BX.create("DIV",{props:{className:"bx-viewer-overlay"}}));this.OVERLAY.appendChild(this.PREV_LINK=BX.create(e,{props:{className:"bx-viewer-prev-outer",href:t},events:{click:BX.proxy(this.prev,this)},html:'<span class="bx-viewer-prev"></span>'}));this.OVERLAY.appendChild(this.NEXT_LINK=BX.create(e,{props:{className:"bx-viewer-next-outer",href:t},events:{click:BX.proxy(this.next,this)},html:'<span class="bx-viewer-next"></span>'}));this.DIV=this.OVERLAY.appendChild(BX.create("DIV",{props:{className:"bx-viewer-wrap-outer"},events:{click:BX.eventCancelBubble},children:[BX.create("DIV",{props:{className:"bx-viewer-wrap-inner"},children:[this.CONTENT_WRAP=BX.create("DIV",{props:{className:"bx-viewer-wrap bx-viewer-cap"}})]}),this.CONTENT_TITLE=BX.create("DIV",{style:{bottom:"0"},props:{className:"bx-viewer-title"}}),this.FULL_TITLE=BX.create("DIV",{style:{bottom:"-32px"},props:{className:"bx-viewer-full-title"}}),BX.create(e,{props:{className:"bx-viewer-close",href:t},events:{click:BX.proxy(this._hide,this)},html:'<span class="bx-viewer-close-inner"></span>'})]}));if(!!this.params.resizeToggle){this.CONTENT_WRAP.appendChild(BX.create("SPAN",{props:{className:"bx-viewer-size-toggle"},style:{right:this.params.minPadding+"px",bottom:this.params.minPadding+"px"},events:{click:BX.proxy(this._toggle_resize,this)}}))}}var i;if(this.params.topPadding){i=this.params.topPadding+"px "+this.params.minPadding+"px "+this.params.minPadding+"px"}else{i=this.params.minPadding+"px"}this.CONTENT_WRAP.parentNode.style.padding=i};BX.CViewer.prototype.setCurrent=function(e){if(!BX.is_subclass_of(e,BX.CViewCoreElement)){BX.debug("current element not instance of BX.CViewCoreElement");return}this.currentElement=e};BX.CViewer.prototype.isCurrent=function(e){if(typeof e=="object"){e=e.id||e.image||e.thumb||e.src}else{return false}var t=this.getCurrent();if(!t){return false}t=t.id||t.image||t.thumb||t.src||false;if(!t){return false}return t==e};BX.CViewer.prototype.getCurrent=function(){if(!BX.is_subclass_of(this.currentElement||this.list[this._current],BX.CViewCoreElement)){BX.debug("current element not instance of BX.CViewCoreElement");return false}else{this.initEventHandlersForElement(this.currentElement||this.list[this._current])}return this.currentElement||this.list[this._current]};BX.CViewer.prototype._keypress=function(e){var t=(e||window.event).keyCode||(e||window.event).charCode;if(!!this.params.keyMap&&!!this.params.keyMap[t]&&!!this[this.params.keyMap[t]]){var i=this.getCurrent();if(i.wrapClassName&&i.wrapClassName==="bx-viewer-video"&&i.innerElementId&&t!=27){if(typeof BX.Fileman.PlayerManager!=="undefined"&&BX.Fileman.PlayerManager.getPlayerById){var r=BX.Fileman.PlayerManager.getPlayerById(i.innerElementId);if(r&&r.isReady()){r.onKeyDown(e);e.preventDefault();return}}}this[this.params.keyMap[t]].apply(this);return BX.PreventDefault(e)}};BX.CViewer.prototype._toggle_resize=function(){var e=this.params.resize;this.params.resize=this.params.resizeToggle;this.params.resizeToggle=e;if(this.params.resize!="WH"){this.params.lockScroll=true;this._lock_scroll()}else{this.params.lockScroll=false;this._unlock_scroll()}this.adjustSize();this.adjustPos()};BX.CViewer.prototype.adjustPos=function(){if(this.getCurrent().height>0&&this.getCurrent().width>0){this._adjustPosByElement()}else{if(this.CONTENT_WRAP){if(!this.CONTENT_WRAP.style.height){}this.CONTENT_WRAP.style.height="100px";if(!this.CONTENT_WRAP.style.width)this.CONTENT_WRAP.style.width="100px"}this.getCurrent().addTimeoutId(setTimeout(BX.proxy(this._adjustPosByElement,this),250))}};BX.CViewer.prototype._adjustPosByElement=function(){if(this.bVisible){var e=BX.GetWindowSize(),t=parseInt((e.innerHeight-parseInt(this.CONTENT_WRAP.style.height)-2*this.params.minPadding-this.params.topPadding)/2),i=parseInt((e.innerWidth-parseInt(this.CONTENT_WRAP.style.width)-2*this.params.minPadding)/2);if(!this.params.lockScroll&&e.innerWidth<e.scrollHeight)i-=20;if(t<this.params.minMargin)t=this.params.minMargin;if(i<this.params.minMargin+Math.min(70,this.PREV_LINK.offsetWidth))i=this.params.minMargin+Math.min(70,this.PREV_LINK.offsetWidth);this.DIV.style.top=t+"px";this.DIV.style.left=i+"px"}};BX.CViewer.prototype.adjustSizeTitle=function(){if(!this.getCurrent().titleButtons||!this.getCurrent().titleDomElement){return false}var e=this.getCurrent().autoReduction;function t(e,t){e=BX(e);if(e.offsetWidth<t){BX.adjust(e,{style:{maxWidth:t+"px"}});return}if(!BX.hasClass(e,"bx-viewer-file-name")){e=BX.findChild(e,{className:"bx-viewer-file-name"},true)}var i=e.innerHTML;var r=i.lastIndexOf(".");var s=i.substring(r);var o=i.substring(0,r);var a=parseInt(t/10)-8;var n=i.substring(0,a)+"..."+o.substring(o.length-3)+s;if(n.length<i.length){e.innerHTML=n}}if(e){t(this.getCurrent().titleDomElement,this.getCurrent().autoReductionWidth);return}var i=BX.findChild(this.getCurrent().titleDomElement,{className:"bx-viewer-file-name"},true);if(!i){return false}if(this.getCurrent().titleButtons.offsetLeft+this.getCurrent().titleButtons.offsetWidth+10>this.getCurrent().titleDomElement.offsetLeft){BX.removeClass(this.getCurrent().titleDomElement,"bx-viewer-file-center");BX.addClass(this.getCurrent().titleDomElement,"bx-viewer-file-right");BX.adjust(i,{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginLeft:this.getCurrent().titleButtons.offsetLeft+this.getCurrent().titleButtons.offsetWidth+"px"}});return true}else{BX.removeClass(this.getCurrent().titleDomElement,"bx-viewer-file-right");BX.addClass(this.getCurrent().titleDomElement,"bx-viewer-file-center");BX.adjust(i,{style:{}})}return false};BX.CViewer.prototype.adjustSize=function(){var e=BX.GetWindowSize(),t=this.getCurrent();if(!!t.height&&!!t.width){if(!this.params.lockScroll&&e.innerWidth<e.scrollHeight)e.innerWidth-=20;e.innerWidth-=this.params.minMargin*2+this.params.minPadding*2+Math.min(140,this.PREV_LINK.offsetWidth+this.NEXT_LINK.offsetWidth);e.innerHeight-=this.params.topPadding+this.params.minMargin*2+this.params.minPadding*2;if(this.params.showTitle&&!!t.title){e.innerHeight-=40}var i=t.height,r=t.width,s=[1];if(this.params.resize){if(this.params.resize.indexOf("W")>=0)s.push(e.innerWidth/r);if(this.params.resize.indexOf("H")>=0)s.push(e.innerHeight/i)}s=Math.min.apply(window,s);i*=s;r*=s;if(t.image){t.image.style.height=parseInt(i)+"px";t.image.style.width=parseInt(r)+"px"}if(t._minWidth&&t._minWidth>r){r=t._minWidth}if(t._minHeight&&t._minHeight>i){i=t._minHeight}this.CONTENT_WRAP.style.height=parseInt(i)+"px";this.CONTENT_WRAP.style.width=parseInt(r)+"px";this.getCurrent().addTimeoutId(setTimeout(BX.proxy(this.adjustSizeTitle,this),300));if(BX.browser.IsIE()){var o=parseInt(this.CONTENT_WRAP.style.height)+this.params.minPadding*2;this.PREV_LINK.style.height=this.NEXT_LINK.style.height=o+"px";this.PREV_LINK.firstChild.style.top=this.NEXT_LINK.firstChild.style.top=parseInt(o/2-20)+"px"}}};BX.CViewer.prototype._lock_scroll=function(){if(this.params.lockScroll)BX.CViewer.lockScroll()};BX.CViewer.prototype._unlock_scroll=function(){if(this.params.lockScroll)BX.CViewer.unlockScroll()};BX.CViewer.prototype._unhide=function(){this.bVisible=true;this.DIV.style.display="block";this.OVERLAY.style.display="block";this.PREV_LINK.style.display=this.NEXT_LINK.style.display="none";if(this.list.length>1&&(this.params.cycle||this._current>0)){this.PREV_LINK.style.display="block";this.PREV_LINK.style.opacity="0.2"}if(this.list.length>1&&(this.params.cycle||this._current<this.list.length-1)){this.NEXT_LINK.style.display="block";this.NEXT_LINK.style.opacity="0.2"}this.adjustPos();this._unbindEvents();this._bindEvents();this._lock_scroll()};BX.CViewer.prototype._bindEvents=function(){BX.bind(document,"keydown",BX.proxy(this._keypress,this));BX.bind(window,"resize",BX.proxy(this.adjustSize,this));BX.bind(window,"resize",BX.proxy(this.adjustPos,this))};BX.CViewer.prototype._unbindEvents=function(){BX.unbind(document,"keydown",BX.proxy(this._keypress,this));BX.unbind(window,"resize",BX.proxy(this.adjustSize,this));BX.unbind(window,"resize",BX.proxy(this.adjustPos,this))};BX.CViewer.prototype._hide=function(){if(this.isOpenedConfirm()){return false}this.bVisible=false;if(!this.DIV){return}this.DIV.style.display="none";this.OVERLAY.style.display="none";this._unbindEvents();this._unlock_scroll();this.getCurrent().hide(true);this.currentElement=null;this.closeConfirm();this.destroyMenu();BX.onCustomEvent(this,"onElementViewClose",[this.getCurrent()])};BX.CViewer.prototype.add=function(e){if(!BX.util.in_array(e.src,this.list.map(function(e){return e.src}))){this.list.push(e)}};BX.CViewer.prototype.setList=function(e){this.list=[];if(!!e&&BX.type.isArray(e)){for(var t=0;t<e.length;t++){if(!BX.is_subclass_of(e[t],BX.CViewCoreElement)){this.add(new BX.CViewCoreElement(e[t]))}else{this.add(e[t])}}}if(this.bVisible){if(this.list.length>0)this.show();else this.close()}};BX.CViewer.prototype.show=function(e,t){BX.CViewer.temporaryServiceEditDoc="";this.initEditService();this.closeConfirm();if(BX.PopupWindowManager.getCurrentPopup()){BX.PopupWindowManager.getCurrentPopup().destroy()}t=t||false;BX.browser.addGlobalClass();var i=this._current;var r=this;if(typeof e=="object"&&(!!e.image||!!e.thumb))e=e.id||e.image||e.thumb||e.src;if(BX.type.isString(e)){for(var s=0;s<this.list.length;s++){if(this.list[s].image==e||this.list[s].thumb==e||this.list[s].src==e||this.list[s].id==e){i=s;break}}}if(!this.currentElement){var o=this.list[i];if(!o)return;this._current=i}else{var o=this.currentElement}this._currentEl=o;var a={};BX.onCustomEvent(this,"onBeforeElementShow",[this,o,a]);if(a&&a.prevent){this.close();return}if(BX.CViewer.enableInVersionDisk(2)&&!o.hasOwnProperty("image")){if(!BX.message("disk_document_service")){this.openWindowForSelectDocumentService({viewInUf:!!BX.message.disk_render_uf});this.close();return}else{if(BX.CViewer.isLocalEditService(this.initEditService())){if(!o.editUrl&&o.fakeEditUrl){o.editUrl=o.fakeEditUrl}if(!o.editUrl){this.runActionByCurrentElement("localview",{obElementViewer:this})}else{this.runActionByCurrentElement("forceedit",{obElementViewer:this})}return}else{}}}this.params.topPadding=0;if(o.showTitle&&o.title){this.params.topPadding=o.topPadding||0}this._create();o.setContentWrap(this.CONTENT_WRAP);BX.cleanNode(this.CONTENT_WRAP);this.adjustSize();if(t){o.hide();o.loaded=false;o.hide()}if(!o.loaded){BX.addClass(this.CONTENT_WRAP,"bx-viewer-wrap-loading");o.load(BX.delegate(function(e){BX.removeClass(this.CONTENT_WRAP,"bx-viewer-wrap-loading");e.show();this.adjustSize();this.adjustPos();this._preload()},this),BX.delegate(function(e,t){BX.removeClass(this.CONTENT_WRAP,"bx-viewer-wrap-loading");if(t&&t.error=="access_denied"){this.showError({text:t.message});if(e.titleButtons){BX.remove(e.titleButtons)}}else if(t&&t.status==="error"){if(t.errors){this.showError({text:t.errors.shift().message})}}},this));this.getCurrent().addTimeoutId(setTimeout(BX.proxy(this.adjustSizeTitle,this),300))}else{o.load(BX.delegate(function(e){BX.removeClass(this.CONTENT_WRAP,"bx-viewer-wrap-loading");this.adjustPos();e.addTimeoutId(setTimeout(BX.delegate(function(){e.show();this.adjustSize()},this),200));this._preload()},this));this.adjustSizeTitle()}if(BX.CViewer.rightNowRunActionAfterShow){this.runActionByCurrentElement(BX.CViewer.rightNowRunActionAfterShow);BX.CViewer.rightNowRunActionAfterShow=false}this.getCurrent().addTimeoutId(setTimeout(BX.proxy(this._check_title,this),10));this._unhide();BX.onCustomEvent(this,"onElementViewShow",[o]);if(BX.type.isDomNode(document.activeElement)){document.activeElement.blur()}BX.focus(window)};BX.CViewer.prototype.showLoading=function(e){this.getCurrent().hide();return BX.CViewer.showLoading(this.CONTENT_WRAP,e)};BX.CViewer.prototype.showError=function(e){this.getCurrent().hide();return BX.CViewer.showError(this.CONTENT_WRAP,e)};BX.CViewer.prototype._check_title=function(){BX.cleanNode(this.CONTENT_TITLE);BX.cleanNode(this.FULL_TITLE);if(this.params.showTitle){if(this.getCurrent().showTitle&&this.getCurrent().title){if(BX.type.isDomNode(this.getCurrent().titleDomElement)){if(BX.type.isDomNode(this.getCurrent().titleButtons)){this.CONTENT_TITLE.appendChild(this.getCurrent().titleButtons)}this.CONTENT_TITLE.appendChild(this.getCurrent().titleDomElement)}else if(BX.type.isNotEmptyString(this.getCurrent().title)){BX.adjust(this.CONTENT_TITLE,{text:this.getCurrent().title})}else{this.CONTENT_TITLE.style.opacity="0";this.CONTENT_TITLE.style.bottom="0"}}else{this.params.topPadding=0}if(this.getCurrent().full){BX.cleanNode(this.FULL_TITLE);var e=this.getCurrent().getBottomHtml();BX.adjust(this.FULL_TITLE,{style:{opacity:"1"},children:[BX.create("div",{props:{className:"bx-viewer-full-item "},html:e})]})}}else{this.CONTENT_TITLE.style.opacity="0";this.CONTENT_TITLE.style.bottom="0";BX.cleanNode(this.CONTENT_TITLE)}};BX.CViewer.prototype._preload=function(){if(this.params.preload>0){var e=Math.max(this._current-this.params.preload,this.params.cycle?-1e3:0),t=Math.min(this._current+this.params.preload,this.params.cycle?this.list.length+1e3:this.list.length-1);if(e<t){for(var i=t;i>=e;i--){var r=i;if(r<0)r+=this.list.length;else if(r>=this.list.length)r-=this.list.length;if(!this.list[r].isProccessed){this.list[r].preload()}}}}};BX.CViewer.prototype.next=function(){if(this.list.length>1){this.destroyMenu();this.getCurrent().hide();this.currentElement=null;this._current++;if(this._current>=this.list.length){if(!!this.params.cycle)this._current=0;else this._current--;BX.onCustomEvent(this,"onElementViewFinishList",[this.getCurrent(),1])}this.getCurrent().preventShow=false;this.show()}};BX.CViewer.prototype.prev=function(){if(this.list.length>1){this.destroyMenu();this.getCurrent().hide();this.currentElement=null;this._current--;if(this._current<0){if(!!this.params.cycle)this._current=this.list.length-1;else this._current++;BX.onCustomEvent(this,"onElementViewFinishList",[this.getCurrent(),-1])}this.getCurrent().preventShow=false;this.show()}};BX.CViewer.prototype.close=function(){this._hide()};BX.CViewer.prototype.submitCurrentElement=function(){this.runActionByCurrentElement("submit",{})};BX.CViewer.prototype.runActionByCurrentElement=function(e,t){t=t||{};if(this.getCurrent()){this.getCurrent().runAction(e,t)}};BX.CViewer.prototype.openModal=function(e,t,i,r){i=i||1030;r=r||700;var s=BX.util.popup(e,i,r);s.elementViewer=this;s.currentElement=this.getCurrent();window._ie_elementViewer=this;window._ie_currentElement=this.getCurrent();return s};BX.CViewer.prototype.isOpenedConfirm=function(){if(this.popupConfirm!=null){return this.popupConfirm.isShown()}return false};BX.CViewer.prototype.closeConfirm=function(){if(this.popupConfirm!=null){this.popupConfirm.close();this.popupConfirm.destroy()}};BX.CViewer.prototype.openConfirm=function(e,t,i,r,s){if(this.popupConfirm!=null)this.popupConfirm.destroy();s=s||{};s.windowName=s.windowName||"";r=r||null;if(typeof e=="object"){}else{e=BX.create("div",{props:{className:"bx-gedit-convert-confirm-cont"},html:e})}i=i===true?true:false;t=typeof t=="object"?t:false;if(!s.autoHide){s.autoHide=t===false?true:false}s.closeByEsc=s.closeByEsc||false;s.zIndex=10200;if(s.overlay){s.overlay=s.overlay}else{s.overlay=i}s.content=e;s.buttons=t;s.events={onPopupClose:function(){this.destroy()}};if(s.shown){s.events.onPopupShow=s.shown}this.popupConfirm=BX.PopupWindowManager.create("bx-gedit-convert-confirm"+s.windowName,r,s);this.popupConfirm.show();BX.addCustomEvent(this.popupConfirm,"onPopupClose",BX.proxy(function(e){this.destroyMenu();if(BX.CViewer.hasLockScroll()){BX.CViewer.unlockScroll()}},this))};BX.CViewer.prototype.destroyMenu=function(){if(this.popupMenu!=null&&this.popupMenu.menu&&this.popupMenu.menu.popupWindow){this.popupMenu.menu.popupWindow.close();this.popupMenu.menu.popupWindow.destroy();if(!BX.type.isArray(BX.CViewer.listPopupId)){return}for(var e in BX.CViewer.listPopupId){if(BX.CViewer.listPopupId.hasOwnProperty(e)){if(BX.PopupMenu.Data[BX.CViewer.listPopupId[e]]&&BX.PopupMenu.Data[BX.CViewer.listPopupId[e]].popupWindow){BX.PopupMenu.Data[BX.CViewer.listPopupId[e]].popupWindow.destroy()}BX.PopupMenu.Data[BX.CViewer.listPopupId[e]]=undefined}}BX.CViewer.listPopupId=[]}};BX.CViewer.prototype.closeMenu=function(){if(this.popupMenu!=null&&this.popupMenu.menu&&this.popupMenu.menu.popupWindow){this.popupMenu.menu.popupWindow.close()}};BX.CViewer.prototype.openMenu=function(e,t,i,r){BX.CViewer.listPopupId.push(e);r=r||{};BX.PopupMenu.show(e,BX(t),i,{offsetTop:r.offsetTop,offsetLeft:r.offsetLeft,angle:{position:"top",offset:45},autoHide:r.autoHide||true,zIndex:r.zIndex||1e4,overlay:{opacity:.01}});this.popupMenu={id:e,menu:BX.PopupMenu.currentItem};return};BX.CViewer.prototype.initEditService=function(){var e;if(BX.CViewer.enableInVersionDisk(2)){e=BX.message("disk_document_service")}else{e=BX.message("wd_service_edit_doc_default")}if(BX.CViewer.localChangeServiceEdit&&BX.localStorage.get("wd_service_edit_doc_default")){e=BX.localStorage.get("wd_service_edit_doc_default")}if(!BX.CViewer.enableInVersionDisk(2)){e=e||"g"}this.setEditService(e);return e};BX.CViewer.prototype.getNameEditService=function(e){e=e||this.initEditService();e=r.normalizeServiceName(e);switch(e){case"gdrive":return BX.message("JS_CORE_VIEWER_SERVICE_GOOGLE_DRIVE");case"onedrive":return BX.message("JS_CORE_VIEWER_SERVICE_SKYDRIVE");case"office365":return BX.message("JS_CORE_VIEWER_SERVICE_OFFICE365");case"myoffice":return BX.message("JS_CORE_VIEWER_SERVICE_MYOFFICE");case"l":case"local":return BX.message("JS_CORE_VIEWER_SERVICE_LOCAL")}return""};BX.CViewer.prototype.setEditService=function(e){if(e&&BX.CViewer.enableInVersionDisk(2)){e=r.normalizeServiceName(e);if(e!=BX.message("disk_document_service")){BX.userOptions.save("disk","doc_service","default",e)}BX.message({disk_document_service:e});BX.userOptions.send(null);if(BX("bx-viewer-edit-service-txt")){BX.adjust(BX("bx-viewer-edit-service-txt"),{text:this.getNameEditService(e)})}BX.CViewer.temporaryServiceEditDoc=e;return true}else if(!BX.CViewer.enableInVersionDisk(2)){e=r.normalizeServiceName(e);if(e){if(BX.CViewer.isLocalEditService(e)&&!BX.CViewer.isEnableLocalEditInDesktop()){e="g"}BX.userOptions.save("webdav","user_settings","service_edit_doc_default",e);BX.localStorage.set("wd_service_edit_doc_default",e,60*2);BX.CViewer.localChangeServiceEdit=true;BX.CViewer.temporaryServiceEditDoc=e;if(BX("bx-viewer-edit-service-txt")){BX.adjust(BX("bx-viewer-edit-service-txt"),{text:this.getNameEditService(e)})}return true}return false}return false};BX.CViewer.isLocalEditService=function(e){e=e.toLowerCase();switch(e){case"l":case"local":return true}return false};BX.CViewer.prototype.openWindowForSelectDocumentService=function(e){if(!BX.Disk){return}BX.Disk.openWindowForSelectDocumentService({viewInUf:e.viewInUf||false,onSave:BX.delegate(function(e){if(e=="l"){if(!BX.CViewer.isEnableLocalEditInDesktop()){this.helpDiskDialog();return}BX.message({disk_document_service:"l"})}else{BX.message({disk_document_service:"gdrive"})}BX.userOptions.save("disk","doc_service","default",BX.message("disk_document_service"));BX.userOptions.send(null);BX.PopupWindowManager.getCurrentPopup().destroy();BX.CViewer.unlockScroll();if(this._currentEl){this.show(this._currentEl)}},this)})};BX.CViewer.prototype.helpDiskDialog=function(e,t,i){e=e||BX.message("JS_CORE_VIEWER_EDIT_IN_LOCAL_SERVICE");t=t||BX.message("JS_CORE_VIEWER_SERVICE_LOCAL_INSTALL_DESKTOP");var r=BX.create("div",{props:{className:"bx-viewer-confirm"},children:[BX.create("div",{props:{className:"bx-viewer-confirm-title"},text:e,children:[]}),BX.create("div",{props:{className:"bx-viewer-confirm-text-wrap"},children:[BX.create("span",{props:{className:"bx-viewer-confirm-text-alignment"}}),BX.create("span",{props:{className:"bx-viewer-confirm-text"},html:t})]})]});var s=BX.CViewer.hasLockScroll();BX.CViewer.lockScroll();this.openConfirm(r,[new BX.PopupWindowButton({text:i?BX.message("JS_CORE_VIEWER_DOWNLOAD_B24_DESKTOP_FULL"):BX.message("JS_CORE_VIEWER_DOWNLOAD_B24_DESKTOP"),className:"popup-window-button-accept",events:{click:BX.delegate(function(){document.location.href=BX.browser.IsMac()?"http://dl.bitrix24.com/b24/bitrix24_desktop.dmg":"http://dl.bitrix24.com/b24/bitrix24_desktop.exe"},this)}}),new BX.PopupWindowButton({text:BX.message("JS_CORE_VIEWER_IFRAME_CANCEL"),events:{click:BX.delegate(function(){this.closeConfirm();if(!s){BX.CViewer.unlockScroll()}},this)}}),i?new BX.PopupWindowButton({text:BX.message("JS_CORE_VIEWER_DOWNLOAD_DOCUMENT"),className:"popup-window-button-accept",events:{click:BX.delegate(function(){document.location.href=i},this)}}):null],true)};BX.CViewer.prototype.createPopupWindowFromErrorElement=function(e){if(e.editInProcess&&e.editInProcess===true){return}var t=e.errorMessage;if(!t){t=BX.message("JS_CORE_VIEWER_IFRAME_ERROR_COULD_NOT_VIEW")}var i={content:BX.create("div",{props:{className:"popup-window-titlebar"},children:[BX.create("span",{props:{className:"popup-window-titlebar-text"},text:e.title}),BX.create("span",{props:{className:"popup-window-titlebar-text-version"},text:e.version?BX.message("JS_CORE_VIEWER_THROUGH_VERSION").replace("#NUMBER#",e.version>0?e.version:""):"("+BX.message("JS_CORE_VIEWER_THROUGH_LAST_VERSION").toLowerCase()+")"})]})};var r=BX.create("div",{props:{className:"bx-viewer-error-popup"},children:[BX.create("div",{props:{className:"bx-viewer-error-popup-file-icon-wrapper"},children:[BX.create("div",{props:{className:"bx-viewer-icon "+e.getIconClassByName(e.title)}})]}),BX.create("div",{props:{className:"bx-viewer-error-popup-right"},children:[BX.create("div",{props:{className:"bx-viewer-error-popup-title"},text:BX.message("JS_CORE_VIEWER_IFRAME_ERROR_TITLE")}),t?BX.create("span",{props:{className:"bx-viewer-error-popup-text"},html:t}):null,!BX.CViewer.isDisabledLocalEdit?BX.create("span",{props:{className:"bx-viewer-error-popup-text"},html:BX.message("JS_CORE_VIEWER_SERVICE_LOCAL_INSTALL_DESKTOP")}):null,!BX.CViewer.isDisabledLocalEdit?BX.create("span",{props:{className:"popup-window-button"},events:{click:BX.delegate(function(){document.location.href=BX.browser.IsMac()?"http://dl.bitrix24.com/b24/bitrix24_desktop.dmg":"http://dl.bitrix24.com/b24/bitrix24_desktop.exe"},this)},text:BX.message("JS_CORE_VIEWER_DOWNLOAD_B24_DESKTOP_FULL")}):null,e.hideEdit?null:e.getComplexEditButton(this,{enableEdit:!!e.editUrl,isLocked:!!e.lockedBy&&e.lockedBy!=BX.message("USER_ID")},true)]})]});this.openConfirm(r,[e.downloadUrl?new BX.PopupWindowButton({text:BX.message("JS_CORE_VIEWER_DOWNLOAD_DOCUMENT"),className:"popup-window-button-accept",events:{click:BX.delegate(function(){document.location.href=e.downloadUrl},this)}}):null,new BX.PopupWindowButton({className:"bx-viewer-error-popup-cancel",text:BX.message("JS_CORE_VIEWER_IFRAME_CONVERT_DECLINE"),events:{click:BX.delegate(function(){this.destroyMenu();this.closeConfirm();this.close()},this)}})],true,null,{titleBar:i,closeIcon:false,closeByEsc:false})};BX.CViewer.prototype.createElementByType=function(e,t){var i=e.getAttribute("data-bx-viewer");t=t||{};if(e.getAttribute("data-bx-title").split(".").pop()=="xodt"){var r=this.createErrorIframeElementFromEditable(this.createIframeElement(e,t));r.disableGoogleViewer=true;return r}switch(i){case"onlyedit":return this.createWithoutPreviewEditableElement(e,t);break;case"iframe":return this.createIframeElement(e,t);break;case"ajax":return this.createAjaxElement(e,t);break}};BX.CViewer.prototype.createErrorIframeElementFromEditable=function(e){var t=new BX.CViewErrorIframeElement({id:e.id,baseElementId:e.baseElementId,title:e.title,src:e.src,owner:e.owner,size:e.size,dateModify:e.dateModify,tooBigSizeMsg:e.tooBigSizeMsg,buttonUrl:e.viewerUrl||e.viewUrl,isFromUserLib:e.isFromUserLib,relativePath:e.relativePath,externalId:e.externalId,objectId:e.objectId,editUrl:e.editUrl,lockedBy:e.lockedBy,urlToPost:e.urlToPost,idToPost:e.idToPost,downloadUrl:e.downloadUrl,historyPageUrl:e.historyPageUrl,askConvert:e.askConvert,version:e.version,pdfFallback:e.pdfFallback,buttons:[]});t.buttons.push(t.getComplexEditButton(this,{enableEdit:!!t.editUrl,isLocked:!!t.lockedBy&&t.lockedBy!=BX.message("USER_ID")}));t.buttons.push(t.getComplexSaveButton(this,{downloadUrl:t.downloadUrl}));return t};BX.CViewer.prototype.createErrorIframeElementFromAjaxElement=function(e,t){e.errorMessage=e.errorMessage||BX.message("JS_CORE_VIEWER_AJAX_CONNECTION_FAILED");if(!t){t=BX.create("div",{props:{className:"bx-viewer-cap-text-block"},children:[BX.create("div",{props:{className:"bx-viewer-cap-title",title:e.title},text:e.title}),BX.create("div",{props:{className:"bx-viewer-too-big-title"},text:e.errorMessage})]})}var i=new BX.CViewErrorIframeElement({id:e.id,baseElementId:e.baseElementId,title:e.title,src:e.src,owner:e.owner,size:e.size,dateModify:e.dateModify,tooBigSizeMsg:e.tooBigSizeMsg,buttonUrl:e.viewerUrl||e.viewUrl,isFromUserLib:e.isFromUserLib,relativePath:e.relativePath,externalId:e.externalId,objectId:e.objectId,editUrl:e.editUrl,lockedBy:e.lockedBy,urlToPost:e.urlToPost,idToPost:e.idToPost,downloadUrl:e.downloadUrl,historyPageUrl:e.historyPageUrl,askConvert:e.askConvert,version:e.version,errorDescription:t,buttons:[]});if(!e.hideEdit){i.buttons.push(e.getComplexEditButton(this,{enableEdit:!!e.editUrl,isLocked:!!e.lockedBy&&e.lockedBy!=BX.message("USER_ID")}))}i.buttons.push(i.getComplexSaveButton(this,{downloadUrl:i.downloadUrl}));return i};BX.CViewer.prototype.createAjaxElementFromIframeElement=function(e,t){var i=new BX.CViewAjaxElement({src:t.src,width:t.width,height:t.height,hideEdit:t.hideEdit,pdfFallback:t["data-bx-pdfFallback"],transformTimeout:t.transformTimeout,baseElementId:e.baseElementId,title:e.title,dateModify:e.dateModify,isFromUserLib:e.isFromUserLib,externalId:e.externalId,objectId:e.objectId,relativePath:e.relativePath,editUrl:e.editUrl,lockedBy:e.lockedBy,fakeEditUrl:e.fakeEditUrl,urlToPost:e.urlToPost,idToPost:e.idToPost,downloadUrl:e.downloadUrl,historyPageUrl:e.historyPageUrl,askConvert:e.askConvert,version:e.version,iframeSrc:e.src,getLastVersionUri:e.getLastVersionUri});if(!i.hideEdit){i.buttons.push(i.getComplexEditButton(this,{enableEdit:!!i.editUrl,isLocked:!!i.lockedBy&&i.lockedBy!=BX.message("USER_ID")}))}i.buttons.push(i.getComplexSaveButton(this,{downloadUrl:i.downloadUrl,reloadAfterDownload:false,showEdit:true}));return i};BX.CViewer.prototype.createIframeElementFromAjaxElement=function(e){var t=new BX.CViewIframeElement({src:e.iframeSrc,width:e.width,height:e.height,hideEdit:e.hideEdit,pdfFallback:e.pdfFallback,transformTimeout:e.transformTimeout,baseElementId:e.baseElementId,title:e.title,dateModify:e.dateModify,isFromUserLib:e.isFromUserLib,externalId:e.externalId,objectId:e.objectId,relativePath:e.relativePath,editUrl:e.editUrl,lockedBy:e.lockedBy,fakeEditUrl:e.fakeEditUrl,urlToPost:e.urlToPost,idToPost:e.idToPost,downloadUrl:e.downloadUrl,historyPageUrl:e.historyPageUrl,askConvert:e.askConvert,version:e.version,getLastVersionUri:e.getLastVersionUri});if(!t.hideEdit){t.buttons.push(t.getComplexEditButton(this,{enableEdit:!!t.editUrl,isLocked:!!t.lockedBy&&t.lockedBy!=BX.message("USER_ID")}))}t.buttons.push(t.getComplexSaveButton(this,{downloadUrl:t.downloadUrl,reloadAfterDownload:true,showEdit:true}));return t};BX.CViewer.prototype.createBlankElementByParams=function(e){e.docType=e.docType||"docx";return new BX.CViewBlankElement(e)};BX.CViewer.prototype.createWithoutPreviewEditableElement=function(e,t){var i=new BX.CViewWithoutPreviewEditableElement({baseElementId:e.getAttribute("data-bx-baseElementId"),title:e.getAttribute("data-bx-title"),src:e.getAttribute("data-bx-src"),owner:e.getAttribute("data-bx-owner"),size:e.getAttribute("data-bx-size"),dateModify:e.getAttribute("data-bx-dateModify"),tooBigSizeMsg:!!e.getAttribute("data-bx-tooBigSizeMsg"),isFromUserLib:!!e.getAttribute("data-bx-isFromUserLib"),externalId:e.getAttribute("data-bx-externalId"),objectId:e.getAttribute("bx-attach-file-id"),relativePath:e.getAttribute("data-bx-relativePath"),editUrl:e.getAttribute("data-bx-edit"),lockedBy:e.getAttribute("data-bx-lockedBy"),fakeEditUrl:e.getAttribute("data-bx-fakeEdit"),urlToPost:e.getAttribute("data-bx-urlToPost"),idToPost:e.getAttribute("data-bx-idToPost"),downloadUrl:e.getAttribute("data-bx-download"),historyPageUrl:e.getAttribute("data-bx-historyPage"),askConvert:e.getAttribute("data-bx-askConvert"),version:t.version>=0?t.version:e.getAttribute("data-bx-version"),buttons:[]});if(i.isConverted()){var r=BX.CViewer._convertElementsMatch[i.src];i.src=r.src;i.title=r.title;i.editUrl=r.editUrl;i.askConvert=false}i.buttons.push(i.getComplexEditButton(this,{enableEdit:!!i.editUrl,isLocked:!!i.lockedBy&&i.lockedBy!=BX.message("USER_ID")}));i.buttons.push(i.getComplexSaveButton(this,{downloadUrl:i.downloadUrl}));return i};BX.CViewer.prototype.createIframeElement=function(e,t){var i=new BX.CViewIframeElement({baseElementId:e.getAttribute("data-bx-baseElementId"),title:e.getAttribute("data-bx-title"),dateModify:e.getAttribute("data-bx-dateModify"),isFromUserLib:!!e.getAttribute("data-bx-isFromUserLib"),externalId:e.getAttribute("data-bx-externalId"),objectId:e.getAttribute("bx-attach-file-id"),relativePath:e.getAttribute("data-bx-relativePath"),editUrl:e.getAttribute("data-bx-edit"),lockedBy:e.getAttribute("data-bx-lockedBy"),hideEdit:e.getAttribute("data-bx-hideEdit"),fakeEditUrl:e.getAttribute("data-bx-fakeEdit"),urlToPost:e.getAttribute("data-bx-urlToPost"),idToPost:e.getAttribute("data-bx-idToPost"),downloadUrl:e.getAttribute("data-bx-download"),historyPageUrl:e.getAttribute("data-bx-historyPage"),src:e.getAttribute("data-bx-src"),askConvert:e.getAttribute("data-bx-askConvert"),version:t.version>=0?t.version:e.getAttribute("data-bx-version"),pdfFallback:e.getAttribute("data-bx-pdfFallback"),previewImage:e.getAttribute("data-bx-previewImage"),transformTimeout:t.transformTimeout,getLastVersionUri:t.getLastVersionUri||e.getAttribute("data-bx-getLastVersionUri"),buttons:[]});if(i.isConverted()){var r=BX.CViewer._convertElementsMatch[i.src];i.src=r.src;i.title=r.title;i.editUrl=r.editUrl;i.askConvert=false}if(!i.hideEdit){i.buttons.push(i.getComplexEditButton(this,{enableEdit:!!i.editUrl,isLocked:!!i.lockedBy&&i.lockedBy!=BX.message("USER_ID")}))}i.buttons.push(i.getComplexSaveButton(this,{downloadUrl:i.downloadUrl,reloadAfterDownload:true,showEdit:true}));return i};BX.CViewer.prototype.createAjaxElement=function(e,t){var i=new BX.CViewAjaxElement({baseElementId:e.getAttribute("data-bx-baseElementId"),title:e.getAttribute("data-bx-title"),dateModify:e.getAttribute("data-bx-dateModify"),isFromUserLib:!!e.getAttribute("data-bx-isFromUserLib"),externalId:e.getAttribute("data-bx-externalId"),objectId:e.getAttribute("bx-attach-file-id"),relativePath:e.getAttribute("data-bx-relativePath"),editUrl:e.getAttribute("data-bx-edit"),lockedBy:e.getAttribute("data-bx-lockedBy"),fakeEditUrl:e.getAttribute("data-bx-fakeEdit"),urlToPost:e.getAttribute("data-bx-urlToPost"),idToPost:e.getAttribute("data-bx-idToPost"),downloadUrl:e.getAttribute("data-bx-download"),historyPageUrl:e.getAttribute("data-bx-historyPage"),src:e.getAttribute("data-bx-src"),askConvert:e.getAttribute("data-bx-askConvert"),version:t.version>=0?t.version:e.getAttribute("data-bx-version"),buttons:[],pdfFallback:e.getAttribute("data-bx-pdfFallback"),width:e.getAttribute("data-bx-width"),height:e.getAttribute("data-bx-height"),hideEdit:e.getAttribute("data-bx-hideEdit"),iframeSrc:e.getAttribute("data-bx-iframeSrc"),transformTimeout:e.getAttribute("data-bx-transformTimeout"),getLastVersionUri:e.getAttribute("data-bx-getLastVersionUri")});if(!i.hideEdit){i.buttons.push(i.getComplexEditButton(this,{enableEdit:!!i.editUrl,isLocked:!!i.lockedBy&&i.lockedBy!=BX.message("USER_ID")}))}i.buttons.push(i.getComplexSaveButton(this,{downloadUrl:i.downloadUrl,reloadAfterDownload:false,showEdit:true}));return i};var r={lastService:null,ajaxDocUrl:"/bitrix/tools/disk/document.php",ajaxUfDocUrl:"/bitrix/tools/disk/uf.php",normalizeServiceName:function(e){switch(e.toLowerCase()){case"g":case"google":case"gdrive":e="gdrive";break;case"s":case"skydrive":case"sky-drive":case"onedrive":e="onedrive";break;case"office365":e="office365";break;case"myoffice":e="myoffice";break;case"l":case"local":e="l";break;default:e="gdrive";break}return e},getUrlViewFile:function(e){e=this.addToLinkParam(e,"service","gvdrive");e=this.addToLinkParam(e,"document_action","show");return e},getUrlCheckView:function(e){e=this.addToLinkParam(e,"service","gvdrive");e=this.addToLinkParam(e,"document_action","checkView");return e},getUrlStartPublishBlank:function(e,t,i){t=this.normalizeServiceName(t);this.lastService=t;e=this.addToLinkParam(e,"service",t);e=this.addToLinkParam(e,"type",i);return e},getUrlCommitBlank:function(e,t,i){e=this.addToLinkParam(e,"service",this.lastService);e=this.addToLinkParam(e,"document_action","saveBlank");e=this.addToLinkParam(e,"type",t);if(i){e=this.addToLinkParam(e,"targetFolderId",i)}return e},getUrlRenameFile:function(e){e=this.addToLinkParam(e,"service",this.lastService);e=this.addToLinkParam(e,"document_action","rename");return e},getUrlCopyToMe:function(e){e=this.addToLinkParam(e,"action","copyToMe");return e},getUrlEditFile:function(e,t){t=this.normalizeServiceName(t);this.lastService=t;e=this.addToLinkParam(e,"service",t);return e},getUrlCommitFile:function(e){e=this.addToLinkParam(e,"service",this.lastService);e=this.addToLinkParam(e,"document_action","commit");return e},getUrlDiscardFile:function(e){e=this.addToLinkParam(e,"service",this.lastService);e=this.addToLinkParam(e,"document_action","discard");return e},getUrlDiscardBlankFile:function(e){e=this.addToLinkParam(e,"service",this.lastService);e=this.addToLinkParam(e,"document_action","discardBlank");return e},addToLinkParam:function(e,t,i){if(!e.length){return"?"+t+"="+i}e=BX.util.remove_url_param(e,t);if(e.indexOf("?")!=-1){return e+"&"+t+"="+i}return e+"?"+t+"="+i}}})(window);
//# sourceMappingURL=core_viewer.map.js